How to use a tape drive
Jump to navigation
Jump to search
Setup
On Red Hat systems, install the mt-st package to get the mt command.
Usage
If you refer to the tape drive as /dev/st0, it will automatically rewind after the command has finished. Refer to it as /dev/nst0 if you don't want it to rewind.
To see where you are on the tape:
mt -f /dev/nst0 status
To explicitly rewind the tape:
mt -f /dev/st0 rewind
To skip ahead to the next record:
mt -f /dev/nst0 fsf
To copy data to the tape:
tar cf /dev/st0 /etc
To read data from the tape (and write to disk):
tar xf /dev/st0
To erase the tape:
mt -f /dev/st0 erase
To eject the tape:
mt -f /dev/st0 eject
Other mt options that may or may not work:
fsf- Forward space count files. The tape is positioned on the first block of the next file.fsfm- Forward space count files. The tape is positioned on the last block of the previous file.bsf- Backward space count files. The tape is positioned on the last block of the previous file.bsfm- Backward space count files. The tape is positioned on the first block of the next file.
Moving data directly from a tape drive to a remote host
On the remote host (assuming barney can access the tape drive on koala):
tar --rsh-command=/usr/bin/ssh -xf barney@koala:/dev/st0
(or xzf if the tape is compressed)