1.\" $OpenBSD: mt.1,v 1.27 2007/11/03 09:05:33 jmc Exp $ 2.\" $NetBSD: mt.1,v 1.8 1996/05/21 10:23:55 mrg Exp $ 3.\" 4.\" Copyright (c) 1981, 1990, 1993 5.\" The Regents of the University of California. All rights reserved. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions 9.\" are met: 10.\" 1. Redistributions of source code must retain the above copyright 11.\" notice, this list of conditions and the following disclaimer. 12.\" 2. Redistributions in binary form must reproduce the above copyright 13.\" notice, this list of conditions and the following disclaimer in the 14.\" documentation and/or other materials provided with the distribution. 15.\" 3. Neither the name of the University nor the names of its contributors 16.\" may be used to endorse or promote products derived from this software 17.\" without specific prior written permission. 18.\" 19.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29.\" SUCH DAMAGE. 30.\" 31.\" @(#)mt.1 8.1 (Berkeley) 6/6/93 32.\" 33.Dd $Mdocdate: November 3 2007 $ 34.Dt MT 1 35.Os 36.Sh NAME 37.Nm mt , 38.Nm eject 39.Nd magnetic tape and removable media manipulating program 40.Sh SYNOPSIS 41.Nm mt 42.Op Fl f Ar device 43.Ar command 44.Op Ar count 45.Nm eject 46.Op Fl t 47.Ar device 48.Sh DESCRIPTION 49The 50.Nm 51utility sends commands to a magnetic tape drive. 52By default, 53.Nm 54performs the requested operation once. 55Operations may be performed multiple times by specifying 56.Ar count . 57Note 58that 59.Ar device 60must reference a raw (not block) tape device. 61If 62.Ar device 63is of the form 64.Dq host:device 65or 66.Dq user@host:device , 67.Nm 68writes to the named tape device on the remote host using 69.Xr rmt 8 . 70.Nm eject 71is simply an alias for 72.Nm mt , 73with the 74.Cm offline 75command specified. 76.Nm eject 77may also be used to eject other types of removable media. 78.Pp 79The options for 80.Nm 81are as follows: 82.Bl -tag -width Ds 83.It Fl f Ar device 84Operate on the 85.Ar device 86specified. 87.El 88.Pp 89The options for 90.Nm eject 91are as follows: 92.Bl -tag -width Ds 93.It Fl t 94Insert the device instead of ejecting. 95For the 96.Xr cd 4 97driver, this requests that the tray be closed. 98.El 99.Pp 100The available commands are listed below. 101Only as many characters as are required to uniquely identify a command 102need be specified. 103.Bl -tag -width "eof, weof" 104.It Cm eof , weof 105Write 106.Ar count 107end-of-file marks at the current position on the tape. 108.It Cm fsf 109Forward space 110.Ar count 111files. 112.It Cm fsr 113Forward space 114.Ar count 115records. 116.It Cm bsf 117Back space 118.Ar count 119files. 120.It Cm bsr 121Back space 122.Ar count 123records. 124.It Cm rewind 125Rewind the tape 126.Pq Ar count Li is ignored . 127.It Cm offline , rewoffl 128Rewind the tape and place the tape unit off-line 129.Pq Ar count Li is ignored . 130On non-tape removable media, the 131.Cm offline 132command causes the media to be ejected when the last operation on it 133closes (i.e., the filesystem is unmounted). 134.It Cm status 135Print status information about the tape unit. 136.It Cm retension 137Retension the tape (if this operation is supported by the tape unit). 138.It Cm erase 139Erase the tape (if this operation is supported by the tape unit). 140.It Cm eom 141Forward space to the end of the media. 142.It Cm blocksize 143Set the tape blocksize to 144.Ar count 145bytes. 146.It Cm density 147Set the tape density code to 148.Ar count 149as specified in the SCSI2 specification. 150.El 151.Pp 152If a tape name is not specified, and the environment variable 153.Ev TAPE 154does not exist, 155.Nm 156uses the device 157.Pa /dev/rst0 . 158The 159.Ev TAPE 160variable is ignored by 161.Nm eject . 162.Pp 163.Nm 164returns a 0 exit status when the operation(s) were successful, 1651 if the command was unrecognized, and 2 if an operation failed. 166.Sh ENVIRONMENT 167If the following environment variable exists, it is utilized by 168.Nm mt . 169.Bl -tag -width Fl 170.It Ev TAPE 171.Nm 172checks the 173.Ev TAPE 174environment variable if the 175argument 176.Ar device 177is not given. 178.El 179.Sh FILES 180.Bl -tag -width /usr/src/sys/scsi/scsi_tape.h -compact 181.It Pa /dev/rst* 182raw SCSI tape interface 183.It Pa /dev/rmt* 184raw magnetic tape interface 185.It Pa /usr/src/sys/scsi/scsi_tape.h 186list of SCSI2 density codes 187.El 188.Sh EXAMPLES 189Eject the first CD device. 190This will work even if there is no CD in the drive: 191.Pp 192.Dl $ eject /dev/rcd0c 193.Sh SEE ALSO 194.Xr cdio 1 , 195.Xr chio 1 , 196.Xr dd 1 , 197.Xr ioctl 2 , 198.Xr mtio 4 199.Sh HISTORY 200The 201.Nm 202utility appeared in 203.At v2 . 204