Linux Command Directory


Linux in a Nutshell

This directory of Linux commands is from Linux in a Nutshell, 5th Edition.

Click on any of the 687 commands below to get a description and list of available options. All links in the command summaries point to the online version of the book on Safari Bookshelf.

Buy it now, or read it online on Safari Bookshelf.



mt

mt [option] operation [count] [arguments]

Control a magnetic tape drive used to back up or restore system data. The version of the mt command documented here is mt-st, which includes support for the st driver for SCSI tape devices. The operation argument determines what action will be taken, and, unless the -f or -t option is used, the action is applied to the default tape drive named in the TAPE environment variable. The count argument determines how many times the operation is to be repeated. If not specified, it defaults to 1. Some operations take one or more arguments other than a count, as noted in the descriptions below.

Options

-f device, -t device

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.

-h, --help

Print usage message and exit. -h prints a simple usage message, while --help also prints a list of commands.

-V, --version

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.

asf n

Move to file number n on the tape. This is the same as rewinding the tape and moving forward n files with fsf.

bsf n

Move backward n files, positioning the tape at the last block of the previous file.

bsfm n

Move backward n file marks, to a position on the side of the file mark closer to the beginning of the tape.

bsr n

Move backward n records.

bss n

SCSI drives only. Move backward n set marks.

compression

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.

defblksize n

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.

defcompression n

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.

defdensity n

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.

defdrvbuffer n

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.

densities

SCSI drives only. Display information about data densities to standard output.

drvbuffer n

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.

eod, seod

Move to the end of valid data on the tape. Used with streamer tapes to append data to the end of the tape.

eof, weof n

Write n end-of-file (EOF) notations at the current location on the tape.

erase

Erase the tape.

fsf n

Move forward n files, positioning the tape at the first block of the next file.

fsfm n

Move forward n file marks, to a position on the side of the file mark closer to the beginning of the tape.

fsr n

Move forward n records.

fss n

SCSI drives only. Move forward n set marks.

load[n]

SCSI drives only. Load the tape, usually used when a new cartridge is inserted. The count, n, can usually be omitted.

lock

SCSI drives only. Lock the tape drive door.

mkpartition n

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.

offline, rewoffl, eject

Rewind and unload the tape (if drive supports unload).

partseek n [partition]

SCSI drives only. Set the tape position to block n in the specified partition. The default partition is 0.

retension

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.

rewind

Return to the beginning of the tape.

seek n

SCSI drives only. Seek to block n on the tape. Use tell to first find the block number.

setblk n

SCSI drives only. Set the block size to n bytes per record.

setdensity n

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.

setpartition [n]

SCSI drives only. Switch to the partition specified by n. The default partition is 0.

status

Display the status of the tape drive.

stclearoptions bits

SCSI drives only. Clear the selected driver option bits, specified as described for stoptions. Requires superuser privileges.

stlongtimeout secs

Set the long timeout for the drive, in seconds. Requires superuser privileges.

stoptions n

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.

stsetcln n

Set the cleaning-request interpretation parameters.

stsetoptions

SCSI drives only. Set the selected driver option bits, specified as described for stoptions. Requires superuser privileges.

sttimeout secs

Set the normal timeout for the drive, in seconds. Requires superuser privileges.

stwrthreshold n

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.

tell

SCSI drives only. Report the number of the current block on the tape.

unlock

SCSI drives only. Unlock the tape drive door.

wset n

SCSI drives only. Write n set marks at current position.

Return codes

0

Operation succeeded

1

Invalid operation or device name

2

Operation failed


More Linux resources from O'Reilly >>

Popular Topics

Browse Books & Videos

International Sites

O'Reilly China O'Reilly Germany O'Reilly Japan