Tape archiving (works for an HP StorageWorks Ultrium 460 using an Adaptec AIC-7892A U160/m (rev 2) SCSI controller)
- # use modconf to load the appropriate module for your scsi adapter (e.g., kernel/drivers/scsi/aic7xxx_old)
- # use modconf to load the module which provides scsi tape support (i.e., kernel/drivers/scsi/st). Once these modules have been loaded successfully, your scsi tape drive and adapter should appear at the end of
dmesg
- # Assume dmesg reports your scsi tape drive as st0:
if [ :$TAPEDRIVE: == :: ];then export TAPEDRIVE=st0;fi
if [ :$REWINDEDTAPE_DEV: == :: ];then export REWINDEDTAPE_DEV=/dev/$TAPEDRIVE;fi
if [ :$UNREWINDEDTAPE_DEV: == :: ];then export UNREWINDEDTAPE_DEV=/dev/n$TAPEDRIVE;fi
- # rewind the current tape:
time mt -f $REWINDEDTAPE_DEV rewind
- # append new data from $DATADIR to the end of the current tape:
time mt -f $REWINDEDTAPE_DEV rewind
time while tar -tzf $UNREWINDEDTAPE_DEV;do date;done #> /tmp/tape.content.txt
time tar -czvf $UNREWINDEDTAPE_DEV --totals --label=":full backup of :$DATADIR: created on `date`:" $DATADIR
- # add $DATADIR to the tape archive without first rewinding the tape:
if [ :$DATADIR: == :: ];then DATADIR=/home;fi
time tar -czvf $UNREWINDEDTAPE_DEV --totals --label=":full backup of :$DATADIR: created on `date`:" $DATADIR
- # rewind the current tape and list its content:
time mt -f $REWINDEDTAPE_DEV rewind
time while tar -tzf $UNREWINDEDTAPE_DEV;do date;done #> /tmp/backup.tape.content.txt
- # restore all data from the current tape, given that it matches $PATTERN:
time mt -f $REWINDEDTAPE_DEV rewind
if [ :$PATTERN: == :: ];then PATTERN=$USER;fi
if [ :$RESTORED: == :: ];then RESTORED="/tmp/restored.from.tape.on.`date`";fi
mkdir -p "$RESTORED"
cd "$RESTORED";time while tar -xzvf $UNREWINDEDTAPE_DEV \*$PATTERN\*;do date;done
- # eject the current tape after rewinding:
time mt -f $REWINDEDTAPE_DEV offline