Know your tape library with mtx and mt
These two commands are very useful to interact with your library and check its current status independently of the CTA layer.
The mtx
command controls single or multi-drive SCSI media changers such as tape libraries.
The mt-st
command performs tape operations on tape drives and can modify some of their settings.
The mtx command
First of all, let's find out the device number of our scsi medium changer (mediumx). The last column should be something like/dev/sgX:
If you already configured the udev rules on your tapeserver (See: Udev rules), you can also use /dev/smc to refer to your scsi media changer instead, as it will be linked to your device. If not, all of the commands below work simply with /dev/sgX.
With the
mtx
command, we can check the basic information of our library (product type, vendor, ID...) with:
We can also check status of the library:
This command reports how many drives and storage elements are contained in the device. For each drive, reports whether it has media loaded in it, and if so, from which storage slot the media originated. See the following output as an example:
We can see two drives (or Data Transfer Elements". First one is loaded with the tape V03650, and the second one is empty. The Storage Elements are tape slots. The ones shown in the example are all full except slot 4, as this tape is currently loaded on one of the drives.
We can perform other tape operations with mtx
:
Load a tape from an slot (storage element) into an empty drive (data transfer element). Note: Drive 0 is assumed if the drive number is ommited (as do all commands!)
Unload a tape from a drive into an empty slot:
The mt-st command
Your tape drives also have a scsi device name to refer to. Lists your devices, and it should be /dev/nstX. Note that if the tape drive is busy doing something else, this commands won't work.
You can check the status of the drive with:
If there is a tape inside the drive, we can rewind the tape:
And then read the first block from the tape:
Finally we can eject the tape:
We can also modify some tape drive settings with this command. For example, set the default compression on/off. However, if you have an IBM library, I recommend you using the ITDT tool to change compression or other settings (See: The IBM Tape Diagnostic Tool):
You can check some of your current drive settings in the following directory:
/sys/class/scsi_tape/nstX/
Useful links:
Last updated