1.\" $NetBSD: mt.1,v 1.33 2003/08/07 09:05:17 agc 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 June 6, 1993 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(Count is ignored). 110.It Cm offline , rewoffl 111Rewind the tape and place the tape unit off-line 112(Count is ignored). 113.It Cm status 114Print status information about the tape unit 115(Count is ignored). 116.It Cm retension 117Retensions the tape 118(Not all tape drives support this feature; count is ignored). 119.It Cm erase 120Erases the tape 121(Not all tape drives support this feature; count is ignored). 122.It Cm eew 123Enable or disabled early warning EOM behaviour. 124.Ar Count 125is set to nonzero to enable, zero to disable. 126.It Cm eom 127Forward space to the end of recorded media 128(Count is ignored). 129.It Cm blocksize , setblk 130Set the tape blocksize to 131.Ar count 132bytes. 133A 134.Ar count 135of zero sets variable blocksize. 136.It Cm density , setdensity 137Set the tape density code to 138.Ar count 139as specified in the 140.Tn SCSI-3 141specification. 142See the 143.Sx DENSITY CODES 144section for a list of codes for commonly used media types. 145.It Cm rdspos 146Read the logical block position of the tape 147(Not all tape drives support this feature; count is ignored). 148.It Cm rdhpos 149Read the hardware block position of the tape 150(Not all tape drives support this feature; count is ignored). 151.It Cm setspos 152Set the logical block position of the tape to 153.Ar count 154(not all tape drives support this feature). 155.It Cm sethpos 156Set the hardware block position of the tape to 157.Ar count 158(not all tape drives support this feature). 159.It Cm compress 160If 161.Ar count 162is zero, disable compression. 163Otherwise enable compression (not all tape drives support this feature). 164.El 165.Pp 166If a tape name is not specified, and the environment variable 167.Ev TAPE 168is not set, then 169.Nm 170uses the device 171.Pa /dev/nrst0 . 172.Sh EXIT STATUS 173.Nm 174returns a 0 exit status when the operation(s) were successful, 1751 if the command was unrecognized, and 2 if an operation failed. 176.Sh DENSITY CODES 177The SCSI-3 specification defines a number of density codes for 178various tape media, some of which are listed here. 179Note that many tape drive vendors also define model-specific codes. 180.Pp 181.Bl -column "Code" "Format" -compact 182.It Em "Code Format" 183.It Li 0 Ta Device default 184.It Li 1 Ta 1/2" 800 bpi 185.It Li 2 Ta 1/2" 1600 bpi 186.It Li 3 Ta 1/2" 6250 bpi 187.It Li 4 Ta QIC-11 188.It Li 5 Ta QIC-24 189.It Li 15 Ta QIC-120 190.It Li 16 Ta QIC-150 191.It Li 17 Ta QIC-320/525 192.It Li 18 Ta QIC-1320/1350 193.It Li 19 Ta DDS 194.It Li 28 Ta QIC-385M 195.It Li 29 Ta QIC-410M 196.It Li 30 Ta QIC-1000C 197.It Li 31 Ta QIC-2100C 198.It Li 32 Ta QIC-6GB 199.It Li 33 Ta QIC-20GB 200.It Li 34 Ta QIC-2GB 201.It Li 35 Ta QIC-875M 202.It Li 36 Ta DDS-2 203.It Li 37 Ta DDS-3 204.It Li 38 Ta DDS-4 205.El 206.Sh ENVIRONMENT 207If the following environment variables exist, they are used by 208.Nm . 209.Bl -tag -width Fl 210.It Ev TAPE 211.Nm 212uses device filename given in the 213.Ev TAPE 214environment variable if the 215.Ar tapename 216argument is not given. 217.It Ev RCMD_CMD 218.Nm 219will use 220.Ev RCMD_CMD 221rather than 222.Pa /usr/bin/rsh 223to invoke 224.Xr rmt 8 225on a remote machine. 226The full path name must be specified. 227.El 228.Sh FILES 229.Bl -tag -width /dev/rst* -compact 230.It Pa /dev/rst* 231Raw 232.Tn SCSI 233tape device 234.It Pa /dev/rmt* 235Raw magnetic tape device 236.El 237.Sh SEE ALSO 238.Xr dd 1 , 239.Xr ioctl 2 , 240.Xr mtio 4 , 241.Xr st 4 , 242.Xr environ 7 243.Sh HISTORY 244The 245.Nm 246utility appeared in 247.Bx 4.3 . 248