]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - share/man/man4/sa.4
MFC sa(4) and mt(1) improvements.
[FreeBSD/stable/10.git] / share / man / man4 / sa.4
1 .\" Copyright (c) 1996
2 .\"     Julian Elischer <julian@FreeBSD.org>.  All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\"
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\"    notice, this list of conditions and the following disclaimer in the
12 .\"    documentation and/or other materials provided with the distribution.
13 .\"
14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 .\" SUCH DAMAGE.
25 .\"
26 .\" $FreeBSD$
27 .\"
28 .Dd February 12, 2015
29 .Dt SA 4
30 .Os
31 .Sh NAME
32 .Nm sa
33 .Nd SCSI Sequential Access device driver
34 .Sh SYNOPSIS
35 .Cd device sa
36 .Sh DESCRIPTION
37 The
38 .Nm
39 driver provides support for all
40 .Tn SCSI
41 devices of the sequential access class that are attached to the system
42 through a supported
43 .Tn SCSI
44 Host Adapter.
45 The sequential access class includes tape and other linear access devices.
46 .Pp
47 A
48 .Tn SCSI
49 Host
50 adapter must also be separately configured into the system
51 before a
52 .Tn SCSI
53 sequential access device can be configured.
54 .Sh MOUNT SESSIONS
55 The
56 .Nm
57 driver is based around the concept of a
58 .Dq Em mount session ,
59 which is defined as the period between the time that a tape is
60 mounted, and the time when it is unmounted.
61 Any parameters set during
62 a mount session remain in effect for the remainder of the session or
63 until replaced.
64 The tape can be unmounted, bringing the session to a
65 close in several ways.
66 These include:
67 .Bl -enum
68 .It
69 Closing a `rewind device',
70 referred to as sub-mode 00 below.
71 An example is
72 .Pa /dev/sa0 .
73 .It
74 Using the MTOFFL
75 .Xr ioctl 2
76 command, reachable through the
77 .Sq Cm offline
78 command of
79 .Xr mt 1 .
80 .El
81 .Pp
82 It should be noted that tape devices are exclusive open devices, except in
83 the case where a control mode device is opened.
84 In the latter case, exclusive
85 access is only sought when needed (e.g., to set parameters).
86 .Sh SUB-MODES
87 Bits 0 and 1 of the minor number are interpreted as
88 .Sq sub-modes .
89 The sub-modes differ in the action taken when the device is closed:
90 .Bl -tag -width XXXX
91 .It 00
92 A close will rewind the device; if the tape has been
93 written, then a file mark will be written before the rewind is requested.
94 The device is unmounted.
95 .It 01
96 A close will leave the tape mounted.
97 If the tape was written to, a file mark will be written.
98 No other head positioning takes place.
99 Any further reads or writes will occur directly after the
100 last read, or the written file mark.
101 .It 10
102 A close will rewind the device.
103 If the tape has been
104 written, then a file mark will be written before the rewind is requested.
105 On completion of the rewind an unload command will be issued.
106 The device is unmounted.
107 .El
108 .Sh BLOCKING MODES
109 .Tn SCSI
110 tapes may run in either
111 .Sq Em variable
112 or
113 .Sq Em fixed
114 block-size modes.
115 Most
116 .Tn QIC Ns -type
117 devices run in fixed block-size mode, where most nine-track tapes and
118 many new cartridge formats allow variable block-size.
119 The difference between the two is as follows:
120 .Bl -inset
121 .It Variable block-size:
122 Each write made to the device results in a single logical record
123 written to the tape.
124 One can never read or write
125 .Em part
126 of a record from tape (though you may request a larger block and read
127 a smaller record); nor can one read multiple blocks.
128 Data from a single write is therefore read by a single read.
129 The block size used
130 may be any value supported by the device, the
131 .Tn SCSI
132 adapter and the system (usually between 1 byte and 64 Kbytes,
133 sometimes more).
134 .Pp
135 When reading a variable record/block from the tape, the head is
136 logically considered to be immediately after the last item read,
137 and before the next item after that.
138 If the next item is a file mark,
139 but it was never read, then the next
140 process to read will immediately hit the file mark and receive an end-of-file notification.
141 .It Fixed block-size:
142 Data written by the user is passed to the tape as a succession of
143 fixed size blocks.
144 It may be contiguous in memory, but it is
145 considered to be a series of independent blocks.
146 One may never write
147 an amount of data that is not an exact multiple of the blocksize.
148 One may read and write the same data as a different set of records.
149 In other words, blocks that were written together may be read separately,
150 and vice-versa.
151 .Pp
152 If one requests more blocks than remain in the file, the drive will
153 encounter the file mark.
154 As there is some data to return (unless
155 there were no records before the file mark), the read will succeed,
156 returning that data.
157 The next read will return immediately with a value
158 of 0.
159 (As above, if the file mark is never read, it remains for the next
160 process to read if in no-rewind mode.)
161 .El
162 .Sh BLOCK SIZES
163 By default, the driver will NOT accept reads or writes to a tape device that
164 are larger than may be written to or read from the mounted tape using a single
165 write or read request.
166 Because of this, the application author may have confidence that his wishes
167 are respected in terms of the block size written to tape.
168 For example, if the user tries to write a 256KB block to the tape, but the
169 controller can handle no more than 128KB, the write will fail.
170 The previous
171 .Fx
172 behavior, prior to
173 .Fx
174 10.0,
175 was to break up large reads or writes into smaller blocks when going to the
176 tape.
177 The problem with that behavior, though, is that it hides the actual on-tape
178 block size from the application writer, at least in variable block mode.
179 .Pp
180 If the user would like his large reads and writes broken up into separate
181 pieces, he may set the following loader tunables.
182 Note that these tunables WILL GO AWAY in
183 .Fx 11.0 .
184 They are provided for transition purposes only.
185 .Bl -tag -width 12
186 .It kern.cam.sa.allow_io_split
187 .Pp
188 This variable, when set to 1, will configure all
189 .Nm
190 devices to split large buffers into smaller pieces when needed.
191 .It kern.cam.sa.%d.allow_io_split
192 .Pp
193 This variable, when set to 1, will configure the given
194 .Nm
195 unit to split large buffers into multiple pieces.
196 This will override the global setting, if it exists.
197 .El
198 .Pp
199 There are several
200 .Xr sysctl 8
201 variables available to view block handling parameters:
202 .Bl -tag -width 12
203 .It kern.cam.sa.%d.allow_io_split
204 .Pp
205 This variable allows the user to see, but not modify, the current I/O split
206 setting.
207 The user is not permitted to modify this setting so that there is no chance
208 of behavior changing for the application while a tape is mounted.
209 .It kern.cam.sa.%d.maxio
210 .Pp
211 This variable shows the maximum I/O size in bytes that is allowed by the
212 combination of kernel tuning parameters (MAXPHYS, DFLTPHYS) and the
213 capabilities of the controller that is attached to the tape drive.
214 Applications may look at this value for a guide on how large an I/O may be
215 permitted, but should keep in mind that the actual maximum may be
216 restricted further by the tape drive via the
217 .Tn SCSI
218 READ BLOCK LIMITS command.
219 .It kern.cam.sa.%d.cpi_maxio
220 .Pp
221 This variable shows the maximum I/O size supported by the controller, in
222 bytes, that is reported via the CAM Path Inquiry CCB (XPT_PATH_INQ).
223 If this is 0, that means that the controller has not reported a maximum I/O
224 size.
225 .El
226 .Sh FILE MARK HANDLING
227 The handling of file marks on write is automatic.
228 If the user has
229 written to the tape, and has not done a read since the last write,
230 then a file mark will be written to the tape when the device is
231 closed.
232 If a rewind is requested after a write, then the driver
233 assumes that the last file on the tape has been written, and ensures
234 that there are two file marks written to the tape.
235 The exception to
236 this is that there seems to be a standard (which we follow, but do not
237 understand why) that certain types of tape do not actually write two
238 file marks to tape, but when read, report a `phantom' file mark when the
239 last file is read.
240 These devices include the QIC family of devices.
241 (It might be that this set of devices is the same set as that of fixed
242 block devices.
243 This has not been determined yet, and they are treated
244 as separate behaviors by the driver at this time.)
245 .Sh IOCTLS
246 The
247 .Nm
248 driver supports all of the ioctls of
249 .Xr mtio 4 .
250 .Sh FILES
251 .Bl -tag -width /dev/[n][e]sa[0-9] -compact
252 .It Pa /dev/[n][e]sa[0-9]
253 general form:
254 .It Pa /dev/sa0
255 Rewind on close
256 .It Pa /dev/nsa0
257 No rewind on close
258 .It Pa /dev/esa0
259 Eject on close (if capable)
260 .It Pa /dev/sa0.ctl
261 Control mode device (to examine state while another program is
262 accessing the device, e.g.).
263 .El
264 .Sh DIAGNOSTICS
265 None.
266 .Sh SEE ALSO
267 .Xr cam 4 ,
268 .Xr mt 1
269 .Sh AUTHORS
270 .An -nosplit
271 The
272 .Nm
273 driver was written for the
274 .Tn CAM
275 .Tn SCSI
276 subsystem by
277 .An Justin T. Gibbs
278 and
279 .An Kenneth Merry .
280 Many ideas were gleaned from the
281 .Nm st
282 device driver written and ported from
283 .Tn Mach
284 2.5
285 by
286 .An Julian Elischer .
287 .Pp
288 The owner of record for many years was
289 .An Matthew Jacob .
290 The current maintainer is
291 .An Kenneth Merry
292 .Sh BUGS
293 This driver lacks many of the hacks required to deal with older devices.
294 Many older
295 .Tn SCSI-1
296 devices may not work properly with this driver yet.
297 .Pp
298 Additionally, certain
299 tapes (QIC tapes mostly) that were written under
300 .Fx
301 2.X
302 are not automatically read correctly with this driver: you may need to
303 explicitly set variable block mode or set to the blocksize that works best
304 for your device in order to read tapes written under
305 .Fx
306 2.X.
307 .Pp
308 Partitions are only supported for status information and location.
309 It would be nice to add support for creating and editing tape partitions.