2 .\" Julian Elischer <julian@FreeBSD.org>. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
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.
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
26 .\" $FreeBSD: src/share/man/man4/sa.4,v 1.22.2.7 2001/08/17 13:08:39 ru Exp $
27 .\" $DragonFly: src/share/man/man4/sa.4,v 1.4 2006/02/17 19:37:09 swildner Exp $
34 .Nd SCSI Sequential Access device driver
37 .Cd device sa1 at scbus0 target 4 unit 0
41 driver provides support for all
43 devices of the sequential access class that are attached to the system
47 The sequential access class includes tape and other linear access devices.
52 adapter must also be separately configured into the system
55 sequential access device can be configured.
59 driver is based around the concept of a
60 .Dq Em mount session ,
61 which is defined as the period between the time that a tape is
62 mounted, and the time when it is unmounted.
63 Any parameters set during
64 a mount session remain in effect for the remainder of the session or
66 The tape can be unmounted, bringing the session to a
67 close in several ways.
71 Closing a `rewind device',
72 referred to as sub-mode 00 below.
78 command, reachable through the
84 It should be noted that tape devices are exclusive open devices, except in
85 the case where a control mode device is opened.
86 In the latter case, exclusive
87 access is only sought when needed (e.g., to set parameters).
89 Bits 0 and 1 of the minor number are interpreted as
91 The sub-modes differ in the action taken when the device is closed:
94 A close will rewind the device; if the tape has been
95 written, then a file mark will be written before the rewind is requested.
96 The device is unmounted.
98 A close will leave the tape mounted.
99 If the tape was written to, a file mark will be written.
100 No other head positioning takes place.
101 Any further reads or writes will occur directly after the
102 last read, or the written file mark.
104 A close will rewind the device.
106 written, then a file mark will be written before the rewind is requested.
107 On completion of the rewind an unload command will be issued.
108 The device is unmounted.
112 tapes may run in either
116 block-size modes. Most
118 devices run in fixed block-size mode, where most nine-track tapes and
119 many new cartridge formats allow variable block-size.
120 The difference between the two is as follows:
122 .It Variable block-size:
123 Each write made to the device results in a single logical record
125 One can never read or write
127 of a record from tape (though you may request a larger block and read
128 a smaller record); nor can one read multiple blocks.
129 Data from a single write is therefore read by a single read.
131 may be any value supported by the device, the
133 adapter and the system (usually between 1 byte and 64 Kbytes,
136 When reading a variable record/block from the tape, the head is
137 logically considered to be immediately after the last item read,
138 and before the next item after that.
139 If the next item is a file mark,
140 but it was never read, then the next
141 process to read will immediately hit the file mark and receive an end-of-file notification.
142 .It Fixed block-size:
143 Data written by the user is passed to the tape as a succession of
145 It may be contiguous in memory, but it is
146 considered to be a series of independent blocks.
148 an amount of data that is not an exact multiple of the blocksize.
149 One may read and write the same data as a different set of records.
150 In other words, blocks that were written together may be read separately,
153 If one requests more blocks than remain in the file, the drive will
154 encounter the file mark.
155 Because there is some data to return (unless
156 there were no records before the file mark), the read will succeed,
158 The next read will return immediately with a value
160 (As above, if the file mark is never read, it remains for the next
161 process to read if in no-rewind mode.)
163 .Sh FILE MARK HANDLING
164 The handling of file marks on write is automatic.
166 written to the tape, and has not done a read since the last write,
167 then a file mark will be written to the tape when the device is
169 If a rewind is requested after a write, then the driver
170 assumes that the last file on the tape has been written, and ensures
171 that there are two file marks written to the tape.
173 this is that there seems to be a standard (which we follow, but don't
174 understand why) that certain types of tape do not actually write two
175 file marks to tape, but when read, report a `phantom' file mark when the
177 These devices include the QIC family of devices.
178 (It might be that this set of devices is the same set as that of fixed
180 This has not been determined yet, and they are treated
181 as separate behaviors by the driver at this time.)
185 driver supports all of the ioctls of
188 .Bl -tag -width /dev/[n][e]sa[0-9] -compact
189 .It Pa /dev/[n][e]sa[0-9]
196 Eject on close (if capable)
198 Control mode device (to examine state while another program is
199 accessing the device, e.g.).
210 driver was written for the
217 Many ideas were gleaned from the
219 device driver written and ported from
223 .An Julian Elischer .
225 The current owner of record is
227 who has suffered too many
228 years of breaking tape drivers.
230 This driver lacks many of the hacks required to deal with older devices.
233 devices may not work properly with this driver yet.
235 Additionally, certain
236 tapes (QIC tapes mostly) that were written under
239 aren't automatically read correctly with this driver: you may need to
240 explicitly set variable block mode or set to the blocksize that works best
241 for your device in order to read tapes written under
245 Fine grained density and compression mode support that is bound to specific
246 device names needs to be added.
248 Support for fast indexing by use of partitions is missing.