xref: /netbsd/bin/mt/mt.1 (revision bf9ec67e)
1.\"	$NetBSD: mt.1,v 1.27 2001/12/20 19:31:51 wiz Exp $
2.\"
3.\" Copyright (c) 1981, 1990, 1993
4.\"	The Regents of the University of California.  All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. All advertising materials mentioning features or use of this software
15.\"    must display the following acknowledgement:
16.\"	This product includes software developed by the University of
17.\"	California, Berkeley and its contributors.
18.\" 4. Neither the name of the University nor the names of its contributors
19.\"    may be used to endorse or promote products derived from this software
20.\"    without specific prior written permission.
21.\"
22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32.\" SUCH DAMAGE.
33.\"
34.\"	@(#)mt.1	8.1 (Berkeley) 6/6/93
35.\"
36.Dd June 6, 1993
37.Dt MT 1
38.Os
39.Sh NAME
40.Nm mt
41.Nd magnetic tape manipulation
42.Sh SYNOPSIS
43.Nm
44.Op Fl f Ar tapename
45.Ar command
46.Op Ar count
47.Sh DESCRIPTION
48The
49.Nm
50program is used to give commands to a magnetic tape drive.
51By default
52.Nm
53performs the requested operation once.
54Operations may be performed multiple times by specifying
55.Ar count  .
56.Pp
57Note
58that
59.Ar tapename
60must reference a raw (not block) tape device.
61If
62.Ar tapename
63is of the form
64.Qq host:tapename ,
65or
66.Qq user@host:tapename ,
67.Nm
68writes to the named tape device on the remote host using
69.Xr rmt 8 .
70.Pp
71The
72.Xr rmt 8
73process on the remote host is typically initiated via
74.Xr rsh 1 ,
75although an alternate method such as
76.Xr ssh 1
77can be specified via the
78.Ev RCMD_CMD
79environment variable.
80.Pp
81The available commands are listed below.
82Only as many characters as are required to uniquely identify a command
83need be specified.
84.Bl -tag -width "eof, weof"
85.It Cm asf
86Move forward
87.Ar count
88files from the beginning of the tape. This is accomplished by a rewind
89followed by fsf
90.Ar count .
91.It Cm eof , weof
92Write
93.Ar count
94end-of-file marks at the current position on the tape.
95.It Cm fsf
96Forward space
97.Ar count
98files.
99.It Cm fsr
100Forward space
101.Ar count
102records.
103.It Cm bsf
104Back space
105.Ar count
106files.
107.It Cm bsr
108Back space
109.Ar count
110records.
111.It Cm rewind
112Rewind the tape
113(Count is ignored).
114.It Cm offline , rewoffl
115Rewind the tape and place the tape unit off-line
116(Count is ignored).
117.It Cm status
118Print status information about the tape unit
119(Count is ignored).
120.It Cm retension
121Retensions the tape (if this operation is supported by the tape unit,
122count is ignored).
123.It Cm erase
124Erases the tape (if this operation is supported by the tape unit,
125count is ignored).
126.It Cm eew
127Enable or disabled early warning EOM behaviour.
128.Ar Count
129is set to nonzero to enable, zero to disable.
130.It Cm eom
131Forward space to the end of recorded media
132(Count is ignored).
133.It Cm blocksize , setblk
134Set the tape blocksize to
135.Ar count
136bytes.
137A
138.Ar count
139of zero sets variable blocksize.
140.It Cm density , setdensity
141Set the tape density code to
142.Ar count
143as specified in the
144.Tn SCSI-3
145specification.  See the
146.Sx DENSITY CODES
147section for a list of codes for commonly used media types.
148.It Cm rdspos
149Read the logical block position of the tape (not all tape
150drives support this feature, count is ignored).
151.It Cm rdhpos
152Read the hardware block position of the tape (not all tape
153drives support this feature, count is ignored).
154.It Cm setspos
155Set the logical block position of the tape to
156.Ar count
157(not all tape drives support this feature).
158.It Cm sethpos
159Set the hardware block position of the tape to
160.Ar count
161(not all tape drives support this feature).
162.It Cm compress
163If
164.Ar count
165is zero, disable compression.
166Otherwise enable compression (not all tape drives support this feature).
167.El
168.Pp
169If a tape name is not specified, and the environment variable
170.Ev TAPE
171is not set, then
172.Nm
173uses the device
174.Pa /dev/nrst0 .
175.Sh EXIT STATUS
176.Nm
177returns a 0 exit status when the operation(s) were successful,
1781 if the command was unrecognized, and 2 if an operation failed.
179.Sh DENSITY CODES
180The SCSI-3 specification defines a number of density codes for
181various tape media, some of which are listed here.  Note that
182many tape drive vendors also define model-specific codes.
183.Pp
184.Bl -column "Code" "Format" -compact
185.It Em "Code	Format"
186.It Li 0 Ta Device default
187.It Li 1 Ta 1/2" 800 bpi
188.It Li 2 Ta 1/2" 1600 bpi
189.It Li 3 Ta 1/2" 6250 bpi
190.It Li 4 Ta QIC-11
191.It Li 5 Ta QIC-24
192.It Li 15 Ta QIC-120
193.It Li 16 Ta QIC-150
194.It Li 17 Ta QIC-320/525
195.It Li 18 Ta QIC-1320/1350
196.It Li 19 Ta DDS
197.It Li 28 Ta QIC-385M
198.It Li 29 Ta QIC-410M
199.It Li 30 Ta QIC-1000C
200.It Li 31 Ta QIC-2100C
201.It Li 32 Ta QIC-6GB
202.It Li 33 Ta QIC-20GB
203.It Li 34 Ta QIC-2GB
204.It Li 35 Ta QIC-875M
205.It Li 36 Ta DDS-2
206.It Li 37 Ta DDS-3
207.It Li 38 Ta DDS-4
208.El
209.Sh ENVIRONMENT
210If the following environment variables exist, they are utilized by
211.Nm "" .
212.Bl -tag -width Fl
213.It Ev TAPE
214.Nm
215uses device filename given in the
216.Ev TAPE
217environment variable if the
218.Ar tapename
219argument is not given.
220.It Ev RCMD_CMD
221.Nm
222will use
223.Ev RCMD_CMD
224rather than
225.Pa /usr/bin/rsh
226to invoke
227.Xr rmt 8
228on a remote machine.
229The full path name must be specified.
230.El
231.Sh FILES
232.Bl -tag -width /dev/rst* -compact
233.It Pa /dev/rst*
234Raw
235.Tn SCSI
236tape device
237.It Pa /dev/rmt*
238Raw magnetic tape device
239.El
240.Sh SEE ALSO
241.Xr dd 1 ,
242.Xr ioctl 2 ,
243.Xr mtio 4 ,
244.Xr st 4 ,
245.Xr environ 7
246.Sh HISTORY
247The
248.Nm
249utility appeared in
250.Bx 4.3 .
251