offline: Prepares the currently loaded tape for ejection and, if applicable, ejects it
fsf: Positions the currently loaded tape
erase: Erases the currently loaded tape
Syntax
The syntax of the mt command specifies a tape device and then issues a command such as rewind.
To specify the device, use the -f option followed by the desired target:
The standard SCSI tape devices are named st0, st1,..., nrst0, nrst1,...
The standard IDE tape devices are named ht0, ht1,..., nrht0, nrht1,...
The standard floppy tape devices are named ftape (rft0) and nftape (nrft0)
Device names beginning with nr refer to "no rewind" devices.
Tape devices referenced with a "no rewind" name will not automatically rewind when the device is closed, for example, when a utility such as dump is finished writing.
The following is the general syntax for the mt command:
mt -f /dev/st0 rewind
Specifies the target device
Indicates the action to perform on the tape.
Linux mt-command
In many cases, mt is used in backup scripts, but may also be used from the command line.
Question:
Enter the command used to erase the information stored on the tape in the first no-rewind standard IDE tape device.
[redhat@localhost redhat]$ mt -f /dev/nrht0 erase
Explanation:The command syntax acts as the following:
The -f flag indicates the specific device or file on which to act; in this case, the first no-rewind standard IDE tape device, /dev/nrht0.
erase is the action to perform.
Using ftape tools for magnetic tape
If your tape drive is attached to an IDE floppy controller cable, you will need to use the ftape driver to access it. Fortunately, the ftape loadable module is bundled with the Linux 2.6 kernel. When your Linux system boots, it should autodetect the tape drive and load the ftape driver.
To verify that your system loaded the tape driver, type the following command shortly after you boot your computer:
dmesg | grep ftape
This searches the most recent kernel messages for lines containing the word ftape. If the
ftape module was loaded, you should see something like this:
If the module was not loaded, then you should check whether your kernel is compiled with
support for the ftape module and your particular tape drive. It should be available and ready to
include as a loadable module.
In most cases, an ftape device can be accessed just like a SCSI device. The primary difference is that an ftape device file contains the letters qft (for QIK Floppy Tape) where a SCSI tape contains st[1].
For example, the device file for the first SCSI tape on your system will probably be /dev/st0; the device file for the first floppy tape will likely be /dev/qft0.
All of the standard
tape- and
archiving-related programs
should work fine with both types of hardware. Nevertheless, there are a few extra programs that you might find useful when working with a floppy tape drive. These programs can be found in the mt-st package in
Fedora. The mt command is used to control magnetic tape operation. The stinit command can initialize SCSI magnetic tape drives.
[1]st - SCSI tape device:
The st driver provides the interface to a variety of SCSI tape devices. Currently, the driver takes control of all detected devices of type "sequential-access". The st driver uses major device number 9.