Examples for the mt-command
To get the status of the tape: mt -f /dev/nst0 stat
Rewind the tape to the start: mt -f /dev/nst0 rewind
Wind to the next file on tape: mt -f /dev/nst0 fsf 1
Transfering data to and from the tape
You usually do this with the “tar” command. “Tar” always needs the
parameter “-f” with the corresponding device, in this case
“/dev/nst0″. The parameter “-v” (verbose) is also suggested. The other
parameters you usually need are:
-c: Create (overwrite) tar-archive. If you overwrite a tar-file
which is not the last one on the tape, all files after the overwritten
one are lost!
-x: Extract from tar-archive at current position on tape.
-t: List contents of tar-archive at current position on tape.
Examples for tar-command
List the contents of the next tar-file on the tape: tar -tvf /dev/nst0
Put the directory (or files and directories) <stuff> (with all
its sub-directories) at the current position on tape: tar -cvf
/dev/nst0 <stuff>
Extract everything from the next tar-file on the tape into the
current directory: tar -xvf /dev/nst0
Extract (only) <stuff> from the next tar-file on the tape into the
current directory: tar -xvf /dev/nst0 <stuff>
Typical sessions
Backup / Store
1. Insert tape in tape drive and probably switch SCSI Switch to one.
2. Check status of tape: mt -f /dev/nst0 stat
3. Probably go to end of tape: mt -f /dev/nst0 eom
4. Store <stuff> on tape: tar -cvf /dev/nst0 <stuff>
5. Rewind and eject tape: mt -f /dev/nst0 offline
Restore
1. Insert tape in tape drive and probably switch SCSI Switch to one.
2. Check status of tape: mt -f /dev/nst0 stat
3. Go to the directory where you want to restore your file(s).
4. Go to the right file on the tape with the following commands:
o Check file number and position in file: mt -f /dev/nst0 stat
o Advance one file: mt -f /dev/nst0 fsf 1
o View contents of tar-file: tar -tvf /dev/nst0
o Go back one file: mt -f /dev/nst0 bsf 1
o If you are in the last block of a file and you should be at the
beginning of the file, do the following:
1. mt -f /dev/nst0 bsf 1
2. mt -f /dev/nst0 fsf 1
And check with: mt -f /dev/nst0 stat
5. Extract your file(s): tar -xvf /dev/nst0 [<files>]
6. Rewind and eject tape: mt -f /dev/nst0 offline