1.\" $NetBSD: mt.1,v 1.30 2002/09/25 15:18:41 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. 89This is accomplished by a rewind followed 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 122(Not all tape drives support this feature; count is ignored). 123.It Cm erase 124Erases the tape 125(Not all tape drives support this feature; count 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. 146See the 147.Sx DENSITY CODES 148section for a list of codes for commonly used media types. 149.It Cm rdspos 150Read the logical block position of the tape 151(Not all tape drives support this feature; count is ignored). 152.It Cm rdhpos 153Read the hardware block position of the tape 154(Not all tape drives support this feature; count is ignored). 155.It Cm setspos 156Set the logical block position of the tape to 157.Ar count 158(not all tape drives support this feature). 159.It Cm sethpos 160Set the hardware block position of the tape to 161.Ar count 162(not all tape drives support this feature). 163.It Cm compress 164If 165.Ar count 166is zero, disable compression. 167Otherwise enable compression (not all tape drives support this feature). 168.El 169.Pp 170If a tape name is not specified, and the environment variable 171.Ev TAPE 172is not set, then 173.Nm 174uses the device 175.Pa /dev/nrst0 . 176.Sh EXIT STATUS 177.Nm 178returns a 0 exit status when the operation(s) were successful, 1791 if the command was unrecognized, and 2 if an operation failed. 180.Sh DENSITY CODES 181The SCSI-3 specification defines a number of density codes for 182various tape media, some of which are listed here. 183Note that many tape drive vendors also define model-specific codes. 184.Pp 185.Bl -column "Code" "Format" -compact 186.It Em "Code Format" 187.It Li 0 Ta Device default 188.It Li 1 Ta 1/2" 800 bpi 189.It Li 2 Ta 1/2" 1600 bpi 190.It Li 3 Ta 1/2" 6250 bpi 191.It Li 4 Ta QIC-11 192.It Li 5 Ta QIC-24 193.It Li 15 Ta QIC-120 194.It Li 16 Ta QIC-150 195.It Li 17 Ta QIC-320/525 196.It Li 18 Ta QIC-1320/1350 197.It Li 19 Ta DDS 198.It Li 28 Ta QIC-385M 199.It Li 29 Ta QIC-410M 200.It Li 30 Ta QIC-1000C 201.It Li 31 Ta QIC-2100C 202.It Li 32 Ta QIC-6GB 203.It Li 33 Ta QIC-20GB 204.It Li 34 Ta QIC-2GB 205.It Li 35 Ta QIC-875M 206.It Li 36 Ta DDS-2 207.It Li 37 Ta DDS-3 208.It Li 38 Ta DDS-4 209.El 210.Sh ENVIRONMENT 211If the following environment variables exist, they are utilized by 212.Nm "" . 213.Bl -tag -width Fl 214.It Ev TAPE 215.Nm 216uses device filename given in the 217.Ev TAPE 218environment variable if the 219.Ar tapename 220argument is not given. 221.It Ev RCMD_CMD 222.Nm 223will use 224.Ev RCMD_CMD 225rather than 226.Pa /usr/bin/rsh 227to invoke 228.Xr rmt 8 229on a remote machine. 230The full path name must be specified. 231.El 232.Sh FILES 233.Bl -tag -width /dev/rst* -compact 234.It Pa /dev/rst* 235Raw 236.Tn SCSI 237tape device 238.It Pa /dev/rmt* 239Raw magnetic tape device 240.El 241.Sh SEE ALSO 242.Xr dd 1 , 243.Xr ioctl 2 , 244.Xr mtio 4 , 245.Xr st 4 , 246.Xr environ 7 247.Sh HISTORY 248The 249.Nm 250utility appeared in 251.Bx 4.3 . 252