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