Howto | Archive to DAT

I am a rank amateur at both tar and mt. This page constitutes no more than you could discover yourself by reading the manpages for tar and mt, or Googling.

You have been warned!

Simple instructions


Use the rewind command before backup to ensure that you are overwriting previous backups.

# mt -f /dev/st0 rewind


E.g. directory /www and /home with tar command (z - compressed)

# tar -czf /dev/st0 /www /home

Use -v to receive verbose feedback.

Backup with Verify

If you do not compress your backup, then you can verify in the same process:

# tar -cWf /dev/st0 /www /home


Find out what block you are at with mt command:

# mt -f /dev/st0 tell

This does not appear to work on my version of the software. In theory the Status option has a line for block number=, but surprising after completing a backup it seems to still return 0. If I ever work out why this is, I will update this entry.


Display list of files on tape drive:

# tar -tzf /dev/st0


E.g. /www directory

# cd /
# mt -f /dev/st0 rewind
# tar -xzf /dev/st0 www

E.g. /home/test directory

# cd /
# mt -f /dev/st0 rewind
# tar --checkpoint -xvvzpkf /dev/st0 home/test

--checkpoint : provide occasional checkpoint messages
-x : extract
-v : verbosely
-v : even more verbosly
-z : uncompress
-p : retaining permissions
-k : leaving existing files alone
-f /dev/st0 home/test


Unload the tape:

# mt -f /dev/st0 offline


Display status information about the tape unit:

# mt -f /dev/st0 status


Erasing the tape may take hours and there is not normally any need to do this; simply rewind the tape before performing backup, or use the mt command to position at the beginning of the tape.

# mt -f /dev/st0 erase

Moving about the tape

You can go BACKWARD or FORWARD on tape with mt command itself

Go to end of data

# mt -f /dev/st0 eod

Goto previous record

# mt -f /dev/st0 bsfm 1

Forward record

# mt -f /dev/st0 fsf 1


This code has not been checked or tested:

Hardware Compression

It may be possible to switch off and on the hardware compression on the:

# mt -f /dev/st0 compression 0
# mt -f /dev/st0 compression 1

Other people report replacing the 0 with “off” and 1 with “on”.


comments powered by Disqus