xref: /netbsd-src/bin/mt/mt.1 (revision f3cfa6f6ce31685c6c4a758bc430e69eb99f50a4)
1.\"	$NetBSD: mt.1,v 1.38 2018/09/01 07:26:56 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. 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 September 1, 2018
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.It Cm cache
188Enable controller buffering.
189.It Cm nocache
190Disable controller buffering.
191.El
192.Pp
193If a tape name is not specified, and the environment variable
194.Ev TAPE
195is not set, then
196.Nm
197uses the device
198.Pa /dev/nrst0 .
199.Sh ENVIRONMENT
200If the following environment variables exist, they are used by
201.Nm .
202.Bl -tag -width Fl
203.It Ev TAPE
204.Nm
205uses device filename given in the
206.Ev TAPE
207environment variable if the
208.Ar tapename
209argument is not given.
210.It Ev RCMD_CMD
211.Nm
212will use
213.Ev RCMD_CMD
214rather than
215.Pa /usr/bin/rsh
216to invoke
217.Xr rmt 8
218on a remote machine.
219The full path name must be specified.
220.El
221.Sh FILES
222.Bl -tag -width /dev/rst* -compact
223.It Pa /dev/rst*
224Raw
225.Tn SCSI
226tape device
227.It Pa /dev/rmt*
228Raw magnetic tape device
229.El
230.Sh EXIT STATUS
231.Nm
232returns a 0 exit status when the operation(s) were successful,
2331 if the command was unrecognized, and 2 if an operation failed.
234.Sh DENSITY CODES
235The SCSI-3 specification defines a number of density codes for
236various tape media, some of which are listed here.
237Note that many tape drive vendors also define model-specific codes.
238.Pp
239.Bl -column "Code" "Format" -compact
240.It Em Code Ta Em Format
241.It Li 0 Ta Device default
242.It Li 1 Ta 1/2" 800 bpi
243.It Li 2 Ta 1/2" 1600 bpi
244.It Li 3 Ta 1/2" 6250 bpi
245.It Li 4 Ta QIC-11
246.It Li 5 Ta QIC-24
247.It Li 15 Ta QIC-120
248.It Li 16 Ta QIC-150
249.It Li 17 Ta QIC-320/525
250.It Li 18 Ta QIC-1320/1350
251.It Li 19 Ta DDS
252.It Li 28 Ta QIC-385M
253.It Li 29 Ta QIC-410M
254.It Li 30 Ta QIC-1000C
255.It Li 31 Ta QIC-2100C
256.It Li 32 Ta QIC-6GB
257.It Li 33 Ta QIC-20GB
258.It Li 34 Ta QIC-2GB
259.It Li 35 Ta QIC-875M
260.It Li 36 Ta DDS-2
261.It Li 37 Ta DDS-3
262.It Li 38 Ta DDS-4
263.El
264.Sh SEE ALSO
265.Xr dd 1 ,
266.Xr ioctl 2 ,
267.Xr mtio 4 ,
268.Xr st 4 ,
269.Xr environ 7
270.Sh HISTORY
271The
272.Nm
273utility appeared in
274.Bx 4.3 .
275