mt
mt
mt [option] operation [count] [arguments]
Control a magnetic tape drive
Options
Name the tape device to use. This may be a local device, a character special file (see mknod), or a remote device, named in the format host:/path/to/drive or
user@host :path/to/drive.
Print usage message and exit. -h prints a simple usage message, while --help also prints a list of commands.
Print version number and exit. Also tells you if you are running mt-st or the GNU version of mt.
Operations
mt can perform the following operations on tape drives. Operations applicable only to SCSI tape drives are marked as such.
Move to file number n on the tape. This is the same as rewinding the tape and moving forward n files with fsf.
Move backward n files, positioning the tape at the last block of the previous file.
Move backward n file marks, to a position on the side of the file mark closer to the beginning of the tape.
Move backward n records.
SCSI drives only. Move backward n set marks.
SCSI drives only. Allow the internal drive compression to be turned on and off with the MTCOMPRESSION
ioctl . Overrides the default value for the current tape. Not supported by all drives.
SCSI drives only. Set the default block size to n, overriding the default for this tape. Setting n to -1 disables the default block size. Requires superuser privileges.
SCSI drives only. Set the default compression state. Set n to -1 to disable the default compression. Use compression to override the default for the current tape. Requires superuser privileges.
SCSI drives only. Set the default density code. Set n to -1 to disable the default density. Use setdensity to override the default for the current tape. Requires superuser privileges.
SCSI drives only. Set the default drive buffer code. Set n to -1 to disable the default drive buffer code. Use drvbuffer to override the default for the current tape. Requires superuser privileges.
SCSI drives only. Display information about data densities to standard output.
SCSI drives only. Set the buffer value. For no buffering, choose 0, and for normal buffering, choose 1. Other values may have different effects depending on the drive. Use to override the default buffer value for the current tape.
Move to the end of valid data on the tape. Used with streamer tapes to append data to the end of the tape.
Write n end-of-file (EOF) notations at the current location on the tape.
Erase the tape.
Move forward n files, positioning the tape at the first block of the next file.
Move forward n file marks, to a position on the side of the file mark closer to the beginning of the tape.
Move forward n records.
SCSI drives only. Move forward n set marks.
SCSI drives only. Load the tape, usually used when a new cartridge is inserted. The count, n, can usually be omitted.
SCSI drives only. Lock the tape drive door.
SCSI drives only. Format the tape. If n is 0, format with one partition. Otherwise, format with two partitions, using n as the size of the second partition. Partition support must be enabled for the drive, and the drive must be able to format partitioned tapes with the user specifying the partition size.
Rewind and unload the tape (if drive supports unload).
SCSI drives only. Set the tape position to block n in the specified partition. The default partition is 0.
Used when the tape has become loosely wound, usually because it has been dropped, shaken, or transported. Rewinds the tape, moves forward to the end of the tape, then rewinds again.
Return to the beginning of the tape.
SCSI drives only. Seek to block n on the tape. Use tell to first find the block number.
SCSI drives only. Set the block size to n bytes per record.
SCSI drives only. Set the data density for your tape drive to n. The appropriate value should be in the tape or tape drive documentation. For more information, see the densities operation. Use to override the default density for the current tape.
SCSI drives only. Switch to the partition specified by n. The default partition is 0.
Display the status of the tape drive.
SCSI drives only. Clear the selected driver option bits, specified as described for stoptions. Requires superuser privileges.
Set the long timeout for the drive, in seconds. Requires superuser privileges.
SCSI drives only. Set the driver option bits for the device. Requires superuser privileges. Set by ORing the option bits from
/usr/include/linux/mtio.h to n, or with the following keywords. Multiple keywords can be specified, and unambiguous abbreviations are allowed.async-writes Enable asynchronous writes.
auto-lock Automatically lock and unlock the drive door.
buffer-writes Enable buffered writes.
can-bsr Drive can space backwards.
can-partitions Drive supports partitioned tapes.
debug Turn on debugging (must have been compiled into the driver).
def-writes Block size and density are for writes.
fast-eod Space directly to the end of the valid data; file number is lost.
no-blklimits Drive does not support read block limits.
no-wait Don't wait for operations, such as rewind, to complete.
read-ahead Enable read-ahead for fixed block size.
scsi2logical seek and tell operations use SCSI-2 logical block addresses instead of device-dependent addresses.
sysv Enable the use of System V semantics.
two-fms Write two file marks when a file is closed.
Set the cleaning-request interpretation parameters.
SCSI drives only. Set the selected driver option bits, specified as described for stoptions. Requires superuser privileges.
Set the normal timeout for the drive, in seconds. Requires superuser privileges.
SCSI drives only. Set the write threshold for the tape drive to n kilobytes. This value may not be higher than the driver buffer value. Requires superuser privileges.
SCSI drives only. Report the number of the current block on the tape.
SCSI drives only. Unlock the tape drive door.
SCSI drives only. Write n set marks at current position.
Return codes
Operation succeeded
Invalid operation or device name
Operation failed