mt-gnu
Control magnetic tape drives
SYNOPSIS
mt [-f device] operation [count]
PARAMETERS
-f device
Specifies the tape device file to use. If not provided, the environment variable TAPE is used or a default value depending on the system.
rewind
Rewinds the tape to the beginning.
offline
Rewinds the tape and takes the drive offline.
rewoffl
Alias for offline (rewind and offline).
erase
Erases the tape. Use with extreme caution as this irreversibly destroys all data on the tape. The type of erase operation depends on the drive. The possible options include `long` or `short`.
fsf count
Forward space `count` files.
bsf count
Backward space `count` files.
fsr count
Forward space `count` records.
bsr count
Backward space `count` records.
weof count
Write `count` end-of-file marks.
eof count
Alias for weof (write end-of-file).
status
Prints the status of the tape drive.
retension
Retensions the tape.
eom
Positions the tape to the end of recorded media.
-t drive
Specifies the tape drive to use. This is a non-standard option that might be used by some system.
-h
Display help and exit.
-V
Output version information and exit.
DESCRIPTION
The `mt-gnu` command is a standard utility for interacting with magnetic tape drives on Linux and other Unix-like systems. It allows users to perform various operations such as rewinding the tape, skipping files or records, writing end-of-file marks, and querying the status of the tape drive. `mt-gnu` is part of the GNU coreutils package and is often a crucial tool for managing backups and archival processes that involve magnetic tapes. Modern implementations support a wide range of tape drive types. The specific commands available depend on the capabilities of the attached tape drive, although a basic set of controls are universally supported to maintain compatibility across different hardware setups. Proper configuration and privileges are necessary to ensure the correct and safe operation of the tape drive using `mt-gnu`.
CAVEATS
Improper use of `mt-gnu`, especially the `erase` command, can lead to irreversible data loss. Ensure you are operating on the correct tape device before executing any commands. Permissions may be needed to access the tape device. The `count` argument for spacing operations can be omitted, in which case it defaults to 1.
DEVICE NAMES
Tape device names often follow a convention like `/dev/st0`, `/dev/nst0`, where `st0` represents the first tape drive and `nst0` represents the first non-rewinding tape drive. Using non-rewinding devices is preferred for scripts that need to perform multiple operations.
ERROR HANDLING
`mt-gnu` typically returns a non-zero exit code if an error occurs during operation. Scripts should check the exit code to ensure successful tape operations.
HISTORY
The `mt-gnu` command has its roots in the Unix tradition of providing utilities for managing tape drives. It has been developed and refined over the years as part of the GNU coreutils project, ensuring its availability and consistent behavior across various Linux distributions.