Tape archiving (works for an HP StorageWorks Ultrium 460 using an Adaptec AIC-7892A U160/m (rev 2) SCSI controller)

  1. # use modconf to load the appropriate module for your scsi adapter (e.g., kernel/drivers/scsi/aic7xxx_old)
  2. # 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 
    
  3. # 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 
    
  4. # rewind the current tape:
     time mt -f $REWINDEDTAPE_DEV rewind 
    
  5. # 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 
    
  6. # 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 
    
  7. # 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 
    
  8. # 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 
    
  9. # eject the current tape after rewinding:
     time mt -f $REWINDEDTAPE_DEV offline