Linux tape backup basics howto

by Marion Bates <mbates at whoopis.com>

Caveats:
The 2.4 kernel has built-in SCSI support; you have to compile it in under 2.6 (legacy scsi support)

Recon:

cat /proc/scsi/scsi
Look for a non-"Direct Access" device. ("Direct Access" devices are hard disks.) If it's not there (for example, because the drive was connected, but powered on after boot), get the rescan-scsi-bus script:
wget http://fedoranews.org/casper/gtkpod/rescan-scsi-bus.sh

Run it:

./rescan-scsi-bus.sh
Look for "NEW" and/or "sequential access"
cat /proc/scsi/scsi

again, and look for:

Host: scsi0 Channel: 00 Id: 05 Lun: 00
  Vendor: IBM      Model: ULTRIUM-TD1      Rev: 25D4
  Type:   Sequential-Access                ANSI SCSI revision: 03
Device name: Will have "s" in name because it's scsi
/dev/nstx
= non-rewindable scsi tape
/dev/stx
= rewindable

x = number We want /dev/st0, the first rewindable scsi tape device.

To check drive status:

mt -f /dev/st0 status

To do mindless, one-time tar backup: The first three steps may be unnecessary, depending on drive model. Ours seems to automatically rewind and you can just let tar overwrite any existing data, rather than wait for the erase step to finish -- it takes a long time to erase the whole 100 GB.

mt -f /dev/st0 rewind
mt -f /dev/st0 erase
mt -f /dev/st0 rewind
mt -f /dev/st0 lock  #to prevent someone hitting eject before it's finished
tar -cvzf /dev/st0 /path/to/stuff/to/back/up/
mt -f /dev/st0 unlock
mt -f /dev/st0 eject


References:

William Stearns, George Bakos.