xref: /dflybsd-src/share/man/man4/sa.4 (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
1*86d7f5d3SJohn Marino.\" Copyright (c) 1996
2*86d7f5d3SJohn Marino.\"	Julian Elischer <julian@FreeBSD.org>.  All rights reserved.
3*86d7f5d3SJohn Marino.\"
4*86d7f5d3SJohn Marino.\" Redistribution and use in source and binary forms, with or without
5*86d7f5d3SJohn Marino.\" modification, are permitted provided that the following conditions
6*86d7f5d3SJohn Marino.\" are met:
7*86d7f5d3SJohn Marino.\" 1. Redistributions of source code must retain the above copyright
8*86d7f5d3SJohn Marino.\"    notice, this list of conditions and the following disclaimer.
9*86d7f5d3SJohn Marino.\"
10*86d7f5d3SJohn Marino.\" 2. Redistributions in binary form must reproduce the above copyright
11*86d7f5d3SJohn Marino.\"    notice, this list of conditions and the following disclaimer in the
12*86d7f5d3SJohn Marino.\"    documentation and/or other materials provided with the distribution.
13*86d7f5d3SJohn Marino.\"
14*86d7f5d3SJohn Marino.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15*86d7f5d3SJohn Marino.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16*86d7f5d3SJohn Marino.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17*86d7f5d3SJohn Marino.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18*86d7f5d3SJohn Marino.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19*86d7f5d3SJohn Marino.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20*86d7f5d3SJohn Marino.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21*86d7f5d3SJohn Marino.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22*86d7f5d3SJohn Marino.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23*86d7f5d3SJohn Marino.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24*86d7f5d3SJohn Marino.\" SUCH DAMAGE.
25*86d7f5d3SJohn Marino.\"
26*86d7f5d3SJohn Marino.\" $FreeBSD: src/share/man/man4/sa.4,v 1.22.2.7 2001/08/17 13:08:39 ru Exp $
27*86d7f5d3SJohn Marino.\" $DragonFly: src/share/man/man4/sa.4,v 1.4 2006/02/17 19:37:09 swildner Exp $
28*86d7f5d3SJohn Marino.\"
29*86d7f5d3SJohn Marino.Dd June 6, 1999
30*86d7f5d3SJohn Marino.Dt SA 4
31*86d7f5d3SJohn Marino.Os
32*86d7f5d3SJohn Marino.Sh NAME
33*86d7f5d3SJohn Marino.Nm sa
34*86d7f5d3SJohn Marino.Nd SCSI Sequential Access device driver
35*86d7f5d3SJohn Marino.Sh SYNOPSIS
36*86d7f5d3SJohn Marino.Cd device sa
37*86d7f5d3SJohn Marino.Cd device sa1 at scbus0 target 4 unit 0
38*86d7f5d3SJohn Marino.Sh DESCRIPTION
39*86d7f5d3SJohn MarinoThe
40*86d7f5d3SJohn Marino.Nm
41*86d7f5d3SJohn Marinodriver provides support for all
42*86d7f5d3SJohn Marino.Tn SCSI
43*86d7f5d3SJohn Marinodevices of the sequential access class that are attached to the system
44*86d7f5d3SJohn Marinothrough a supported
45*86d7f5d3SJohn Marino.Tn SCSI
46*86d7f5d3SJohn MarinoHost Adapter.
47*86d7f5d3SJohn MarinoThe sequential access class includes tape and other linear access devices.
48*86d7f5d3SJohn Marino.Pp
49*86d7f5d3SJohn MarinoA
50*86d7f5d3SJohn Marino.Tn SCSI
51*86d7f5d3SJohn MarinoHost
52*86d7f5d3SJohn Marinoadapter must also be separately configured into the system
53*86d7f5d3SJohn Marinobefore a
54*86d7f5d3SJohn Marino.Tn SCSI
55*86d7f5d3SJohn Marinosequential access device can be configured.
56*86d7f5d3SJohn Marino.Sh MOUNT SESSIONS
57*86d7f5d3SJohn MarinoThe
58*86d7f5d3SJohn Marino.Nm
59*86d7f5d3SJohn Marinodriver is based around the concept of a
60*86d7f5d3SJohn Marino.Dq Em mount session ,
61*86d7f5d3SJohn Marinowhich is defined as the period between the time that a tape is
62*86d7f5d3SJohn Marinomounted, and the time when it is unmounted.
63*86d7f5d3SJohn MarinoAny parameters set during
64*86d7f5d3SJohn Marinoa mount session remain in effect for the remainder of the session or
65*86d7f5d3SJohn Marinountil replaced.
66*86d7f5d3SJohn MarinoThe tape can be unmounted, bringing the session to a
67*86d7f5d3SJohn Marinoclose in several ways.
68*86d7f5d3SJohn MarinoThese include:
69*86d7f5d3SJohn Marino.Bl -enum
70*86d7f5d3SJohn Marino.It
71*86d7f5d3SJohn MarinoClosing a `rewind device',
72*86d7f5d3SJohn Marinoreferred to as sub-mode 00 below.
73*86d7f5d3SJohn MarinoAn example is
74*86d7f5d3SJohn Marino.Pa /dev/sa0 .
75*86d7f5d3SJohn Marino.It
76*86d7f5d3SJohn MarinoUsing the MTOFFL
77*86d7f5d3SJohn Marino.Xr ioctl 2
78*86d7f5d3SJohn Marinocommand, reachable through the
79*86d7f5d3SJohn Marino.Sq Cm offline
80*86d7f5d3SJohn Marinocommand of
81*86d7f5d3SJohn Marino.Xr mt 1 .
82*86d7f5d3SJohn Marino.El
83*86d7f5d3SJohn Marino.Pp
84*86d7f5d3SJohn MarinoIt should be noted that tape devices are exclusive open devices, except in
85*86d7f5d3SJohn Marinothe case where a control mode device is opened.
86*86d7f5d3SJohn MarinoIn the latter case, exclusive
87*86d7f5d3SJohn Marinoaccess is only sought when needed (e.g., to set parameters).
88*86d7f5d3SJohn Marino.Sh SUB-MODES
89*86d7f5d3SJohn MarinoBits 0 and 1 of the minor number are interpreted as
90*86d7f5d3SJohn Marino.Sq sub-modes .
91*86d7f5d3SJohn MarinoThe sub-modes differ in the action taken when the device is closed:
92*86d7f5d3SJohn Marino.Bl -tag -width XXXX
93*86d7f5d3SJohn Marino.It 00
94*86d7f5d3SJohn MarinoA close will rewind the device; if the tape has been
95*86d7f5d3SJohn Marinowritten, then a file mark will be written before the rewind is requested.
96*86d7f5d3SJohn MarinoThe device is unmounted.
97*86d7f5d3SJohn Marino.It 01
98*86d7f5d3SJohn MarinoA close will leave the tape mounted.
99*86d7f5d3SJohn MarinoIf the tape was written to, a file mark will be written.
100*86d7f5d3SJohn MarinoNo other head positioning takes place.
101*86d7f5d3SJohn MarinoAny further reads or writes will occur directly after the
102*86d7f5d3SJohn Marinolast read, or the written file mark.
103*86d7f5d3SJohn Marino.It 10
104*86d7f5d3SJohn MarinoA close will rewind the device.
105*86d7f5d3SJohn MarinoIf the tape has been
106*86d7f5d3SJohn Marinowritten, then a file mark will be written before the rewind is requested.
107*86d7f5d3SJohn MarinoOn completion of the rewind an unload command will be issued.
108*86d7f5d3SJohn MarinoThe device is unmounted.
109*86d7f5d3SJohn Marino.El
110*86d7f5d3SJohn Marino.Sh BLOCKING MODES
111*86d7f5d3SJohn Marino.Tn SCSI
112*86d7f5d3SJohn Marinotapes may run in either
113*86d7f5d3SJohn Marino.Sq Em variable
114*86d7f5d3SJohn Marinoor
115*86d7f5d3SJohn Marino.Sq Em fixed
116*86d7f5d3SJohn Marinoblock-size modes.  Most
117*86d7f5d3SJohn Marino.Tn QIC Ns -type
118*86d7f5d3SJohn Marinodevices run in fixed block-size mode, where most nine-track tapes and
119*86d7f5d3SJohn Marinomany new cartridge formats allow variable block-size.
120*86d7f5d3SJohn MarinoThe difference between the two is as follows:
121*86d7f5d3SJohn Marino.Bl -inset
122*86d7f5d3SJohn Marino.It Variable block-size:
123*86d7f5d3SJohn MarinoEach write made to the device results in a single logical record
124*86d7f5d3SJohn Marinowritten to the tape.
125*86d7f5d3SJohn MarinoOne can never read or write
126*86d7f5d3SJohn Marino.Em part
127*86d7f5d3SJohn Marinoof a record from tape (though you may request a larger block and read
128*86d7f5d3SJohn Marinoa smaller record); nor can one read multiple blocks.
129*86d7f5d3SJohn MarinoData from a single write is therefore read by a single read.
130*86d7f5d3SJohn MarinoThe block size used
131*86d7f5d3SJohn Marinomay be any value supported by the device, the
132*86d7f5d3SJohn Marino.Tn SCSI
133*86d7f5d3SJohn Marinoadapter and the system (usually between 1 byte and 64 Kbytes,
134*86d7f5d3SJohn Marinosometimes more).
135*86d7f5d3SJohn Marino.Pp
136*86d7f5d3SJohn MarinoWhen reading a variable record/block from the tape, the head is
137*86d7f5d3SJohn Marinologically considered to be immediately after the last item read,
138*86d7f5d3SJohn Marinoand before the next item after that.
139*86d7f5d3SJohn MarinoIf the next item is a file mark,
140*86d7f5d3SJohn Marinobut it was never read, then the next
141*86d7f5d3SJohn Marinoprocess to read will immediately hit the file mark and receive an end-of-file notification.
142*86d7f5d3SJohn Marino.It Fixed block-size:
143*86d7f5d3SJohn MarinoData written by the user is passed to the tape as a succession of
144*86d7f5d3SJohn Marinofixed size blocks.
145*86d7f5d3SJohn MarinoIt may be contiguous in memory, but it is
146*86d7f5d3SJohn Marinoconsidered to be a series of independent blocks.
147*86d7f5d3SJohn MarinoOne may never write
148*86d7f5d3SJohn Marinoan amount of data that is not an exact multiple of the blocksize.
149*86d7f5d3SJohn MarinoOne may read and write the same data as a different set of records.
150*86d7f5d3SJohn MarinoIn other words, blocks that were written together may be read separately,
151*86d7f5d3SJohn Marinoand vice-versa.
152*86d7f5d3SJohn Marino.Pp
153*86d7f5d3SJohn MarinoIf one requests more blocks than remain in the file, the drive will
154*86d7f5d3SJohn Marinoencounter the file mark.
155*86d7f5d3SJohn MarinoBecause there is some data to return (unless
156*86d7f5d3SJohn Marinothere were no records before the file mark), the read will succeed,
157*86d7f5d3SJohn Marinoreturning that data.
158*86d7f5d3SJohn MarinoThe next read will return immediately with a value
159*86d7f5d3SJohn Marinoof 0.
160*86d7f5d3SJohn Marino(As above, if the file mark is never read, it remains for the next
161*86d7f5d3SJohn Marinoprocess to read if in no-rewind mode.)
162*86d7f5d3SJohn Marino.El
163*86d7f5d3SJohn Marino.Sh FILE MARK HANDLING
164*86d7f5d3SJohn MarinoThe handling of file marks on write is automatic.
165*86d7f5d3SJohn MarinoIf the user has
166*86d7f5d3SJohn Marinowritten to the tape, and has not done a read since the last write,
167*86d7f5d3SJohn Marinothen a file mark will be written to the tape when the device is
168*86d7f5d3SJohn Marinoclosed.
169*86d7f5d3SJohn MarinoIf a rewind is requested after a write, then the driver
170*86d7f5d3SJohn Marinoassumes that the last file on the tape has been written, and ensures
171*86d7f5d3SJohn Marinothat there are two file marks written to the tape.
172*86d7f5d3SJohn MarinoThe exception to
173*86d7f5d3SJohn Marinothis is that there seems to be a standard (which we follow, but don't
174*86d7f5d3SJohn Marinounderstand why) that certain types of tape do not actually write two
175*86d7f5d3SJohn Marinofile marks to tape, but when read, report a `phantom' file mark when the
176*86d7f5d3SJohn Marinolast file is read.
177*86d7f5d3SJohn MarinoThese devices include the QIC family of devices.
178*86d7f5d3SJohn Marino(It might be that this set of devices is the same set as that of fixed
179*86d7f5d3SJohn Marinoblock devices.
180*86d7f5d3SJohn MarinoThis has not been determined yet, and they are treated
181*86d7f5d3SJohn Marinoas separate behaviors by the driver at this time.)
182*86d7f5d3SJohn Marino.Sh IOCTLS
183*86d7f5d3SJohn MarinoThe
184*86d7f5d3SJohn Marino.Nm
185*86d7f5d3SJohn Marinodriver supports all of the ioctls of
186*86d7f5d3SJohn Marino.Xr mtio 4 .
187*86d7f5d3SJohn Marino.Sh FILES
188*86d7f5d3SJohn Marino.Bl -tag -width /dev/[n][e]sa[0-9] -compact
189*86d7f5d3SJohn Marino.It Pa /dev/[n][e]sa[0-9]
190*86d7f5d3SJohn Marinogeneral form:
191*86d7f5d3SJohn Marino.It Pa /dev/sa0
192*86d7f5d3SJohn MarinoRewind on close
193*86d7f5d3SJohn Marino.It Pa /dev/nsa0
194*86d7f5d3SJohn MarinoNo rewind on close
195*86d7f5d3SJohn Marino.It Pa /dev/esa0
196*86d7f5d3SJohn MarinoEject on close (if capable)
197*86d7f5d3SJohn Marino.It Pa /dev/sa0.ctl
198*86d7f5d3SJohn MarinoControl mode device (to examine state while another program is
199*86d7f5d3SJohn Marinoaccessing the device, e.g.).
200*86d7f5d3SJohn Marino.El
201*86d7f5d3SJohn Marino.Sh DIAGNOSTICS
202*86d7f5d3SJohn MarinoNone.
203*86d7f5d3SJohn Marino.Sh SEE ALSO
204*86d7f5d3SJohn Marino.Xr mt 1 ,
205*86d7f5d3SJohn Marino.Xr scsi 4
206*86d7f5d3SJohn Marino.Sh AUTHORS
207*86d7f5d3SJohn Marino.An -nosplit
208*86d7f5d3SJohn MarinoThe
209*86d7f5d3SJohn Marino.Nm
210*86d7f5d3SJohn Marinodriver was written for the
211*86d7f5d3SJohn Marino.Tn CAM
212*86d7f5d3SJohn Marino.Tn SCSI
213*86d7f5d3SJohn Marinosubsystem by
214*86d7f5d3SJohn Marino.An Justin T. Gibbs
215*86d7f5d3SJohn Marinoand
216*86d7f5d3SJohn Marino.An Kenneth Merry .
217*86d7f5d3SJohn MarinoMany ideas were gleaned from the
218*86d7f5d3SJohn Marino.Nm st
219*86d7f5d3SJohn Marinodevice driver written and ported from
220*86d7f5d3SJohn Marino.Tn Mach
221*86d7f5d3SJohn Marino2.5
222*86d7f5d3SJohn Marinoby
223*86d7f5d3SJohn Marino.An Julian Elischer .
224*86d7f5d3SJohn Marino.Pp
225*86d7f5d3SJohn MarinoThe current owner of record is
226*86d7f5d3SJohn Marino.An Matthew Jacob
227*86d7f5d3SJohn Marinowho has suffered too many
228*86d7f5d3SJohn Marinoyears of breaking tape drivers.
229*86d7f5d3SJohn Marino.Sh BUGS
230*86d7f5d3SJohn MarinoThis driver lacks many of the hacks required to deal with older devices.
231*86d7f5d3SJohn MarinoMany older
232*86d7f5d3SJohn Marino.Tn SCSI-1
233*86d7f5d3SJohn Marinodevices may not work properly with this driver yet.
234*86d7f5d3SJohn Marino.Pp
235*86d7f5d3SJohn MarinoAdditionally, certain
236*86d7f5d3SJohn Marinotapes (QIC tapes mostly) that were written under
237*86d7f5d3SJohn Marino.Fx
238*86d7f5d3SJohn Marino2.X
239*86d7f5d3SJohn Marinoaren't automatically read correctly with this driver: you may need to
240*86d7f5d3SJohn Marinoexplicitly set variable block mode or set to the blocksize that works best
241*86d7f5d3SJohn Marinofor your device in order to read tapes written under
242*86d7f5d3SJohn Marino.Fx
243*86d7f5d3SJohn Marino2.X.
244*86d7f5d3SJohn Marino.Pp
245*86d7f5d3SJohn MarinoFine grained density and compression mode support that is bound to specific
246*86d7f5d3SJohn Marinodevice names needs to be added.
247*86d7f5d3SJohn Marino.Pp
248*86d7f5d3SJohn MarinoSupport for fast indexing by use of partitions is missing.
249