Title: DLT Commands in Linux Subject: Debuggin DLT with a shell and Arkeia stuff ########################################################## # ARKEIA stuff # 1. On the clients, add the fqdn of the ARKEIA server /usr/knox/nlp/admin.cfg NLSERVD restart # 2. On the server, restart the service /etc/init.d/arkeia restart NLSERVD restart #To get the canger working, I had to manually run modprobe -a \* to get sg #module loaded. lsmod |egrep "sg|st" ########################################################## # Sample Backup Scripts ########################################################## # Backup a home directory across a modem link #!/bin/sh export PATH=/usr/local/bin:/usr/bin:/bin LIST="rootfs usr data data2" for d in $LIST; do mount /backup/$d rsync -ax --exclude fstab --delete /$d/ /backup/$d/ umount /backup/$d done DAY=`date "+%A"` rsync -a --delete /usr/local/apache /data2/backups/$DAY rsync -a --delete /data/solid /data2/backups/$DAY # Backup a home directory across a modem link #!/bin/sh cd ~susan { echo date dest=~/backup/`date +%A` mkdir $dest.new find . -xdev -type f \( -mtime 0 -or -mtime 1 \) -exec cp -aPv "{}" $dest.new \; cnt=`find $dest.new -type f | wc -l` if [ $cnt -gt 0 ]; then rm -rf $dest mv $dest.new $dest fi rm -rf $dest.new rsync -Cavze ssh . samba:backup } >> ~/backup/backup.log 2>&1 ######################################## # history off sfdev1 ######################################## 900 rsync -azv -e ssh [houv]* root@parallel:/raid/server_backups/sfdev1.corp.skyflow.com.2001/ 998 rpm -U rsync-2.4.6-1.i386.rpm 1000 history |grep rsync ######################################## # backup script for sfdev1 ######################################## #!/bin/sh echo " #########################################################" echo "Script to rsync southbridge started on `date +%Y%m%d`." echo " #########################################################" backup_title=southbridge`date +%Y%m%d` if [ ! -d $backup_title ] then echo "$backup_title does not exist." echo "Creating $backup_title directory." mkdir /raid/server_backups/$backup_title fi cd /raid/server_backups/$backup_title export PATH=/usr/local/bin:/usr/bin:/bin LIST="home etc var usr dev \ fixpack2 lib service \ opt opt1 opt2 sbin bin \ boot AdminNotes CVSROOT db2backup \ root" for directory in $LIST do df -k rsync -avz -e ssh root@sfdev1:/$directory . done ############################################# # find the dlt dirve ############################################# device=`ls /dev/st?` for dev in $device do mt -f $dev stat done ln -s /dev/st0 /dev/dlt mt -f /dev/st1 rewind mt -f /dev/st1 load ########################################## # Ideally, insert a tape, and type this ########################################## mt -f /dev/nst0 stat # check it's status mt -f /dev/nst0 eod # append to the end tar -cvf /dev/nst0 # backup to tape mt -f /dev/nst0 offline # rewind the tape mtx unload # eject dlt # Ideal restore: mt -f /dev/nst0 stat # check it's status cd #Go to the right place on the tape # with these commands: mt -f /dev/nst0 # check the file position: mt -f /dev/nst0 fsf 1 # advance 1 file tar -tvf /dev/nst0 # view contents of tar file mt -f /dev/nst0 bsf 1 # go back one file tar -xvf /dev/nst0 # restore your files mt -f /dev/nst0 offline # rewind and eject the tape. mtx unload # eject dlt # Remote dlt backup tar -cvf root@hostname:/dev/nst0 ############################################# # find the dlt dirve ############################################# # /usr/local/sbin/mtx -f /dev/sg1 inquiry Product Type: Medium Changer Vendor ID: 'HP ' Product ID: 'C6280-7000 ' Revision: '2.07' Attached Changer: No # inquiry works: /usr/local/sbin/mtx -f /dev/sg0 inquiry Product Type: Tape Drive Vendor ID: 'QUANTUM ' Product ID: 'DLT7000 ' Revision: '2560' Attached Changer: No /usr/local/sbin/loaderinfo -f /dev/sg0 Product Type: Tape Drive Vendor ID: 'QUANTUM ' Product ID: 'DLT7000 ' Revision: '2560' Attached Changer: No Bar Code Reader: Yes EAAP: No Transport Geometry Descriptor Page: No Device Configuration Page: No #--------------------------------------------- #inventory of sg1 works: /usr/local/sbin/mtx -f /dev/sg1 inventory #--------------------------------------------- # status works: /usr/local/sbin/mtx -f /dev/sg0 status mtx: Request Sense: Long Report=yes mtx: Request Sense: Valid Residual=no mtx: Request Sense: Error Code=70 (Current) mtx: Request Sense: Sense Key=Not Ready mtx: Request Sense: FileMark=no mtx: Request Sense: EOM=no mtx: Request Sense: ILI=no mtx: Request Sense: Additional Sense Code = 04 mtx: Request Sense: Additional Sense Qualifier = 00 mtx: Request Sense: BPV=no mtx: Request Sense: Error in CDB=no mtx: Request Sense: SKSV=no READ ELEMENT STATUS Command Failed /usr/local/sbin/mtx -f /dev/sg1 status Storage Changer /dev/sg1:1 Drives, 8 Slots ( 0 Import/Export ) Data Transfer Element 0:Empty Storage Element 1:Full Storage Element 2:Full Storage Element 3:Full Storage Element 4:Full Storage Element 5:Full Storage Element 6:Full Storage Element 7:Empty Storage Element 8:Empty #--------------------------------------------- # load works: /usr/local/sbin/mtx -f /dev/sg1 load 1 0 /usr/local/sbin/mtx -f /dev/sg1 status Storage Changer /dev/sg1:1 Drives, 8 Slots ( 0 Import/Export ) Data Transfer Element 0:Full (Storage Element 1 Loaded) Storage Element 1:Empty Storage Element 2:Full Storage Element 3:Full Storage Element 4:Full Storage Element 5:Full Storage Element 6:Full Storage Element 7:Empty Storage Element 8:Empty #--------------------------------------------- # unload works: unload /usr/local/sbin/mtx -f /dev/sg1 unload 1 0 Unloading Data Transfer Element into Storage Element 1... /usr/local/sbin/mtx -f /dev/sg1 status Storage Changer /dev/sg1:1 Drives, 8 Slots ( 0 Import/Export ) Data Transfer Element 0:Empty Storage Element 1:Full Storage Element 2:Full Storage Element 3:Full Storage Element 4:Full Storage Element 5:Full Storage Element 6:Full Storage Element 7:Empty Storage Element 8:Empty #--------------------------------------------- # loader info commands work /usr/local/sbin/loaderinfo -f /dev/sg0 Product Type: Tape Drive Vendor ID: 'QUANTUM ' Product ID: 'DLT7000 ' Revision: '2560' Attached Changer: No Bar Code Reader: Yes EAAP: No Transport Geometry Descriptor Page: No Device Configuration Page: No /usr/local/sbin/loaderinfo -f /dev/sg1 Product Type: Medium Changer Vendor ID: 'HP ' Product ID: 'C6280-7000 ' Revision: '2.07' Attached Changer: No EAAP: Yes Number of Medium Transport Elements: 1 Number of Storage Elements: 8 Number of Import/Export Element Elements: 0 Number of Data Transfer Elements: 1 Transport Geometry Descriptor Page: Yes Invertable: No Device Configuration Page: Yes Can Transfer: No #--------------------------------------------- # Tapeinfo works: checked with tape loaded and unloaded. /usr/local/sbin/mtx -f /dev/sg1 load 1 0 /usr/local/sbin/tapeinfo -f /dev/sg0 Product Type: Tape Drive Vendor ID: 'QUANTUM ' Product ID: 'DLT7000 ' Revision: '2560' Attached Changer: No SerialNumber: 'CX929S1439' TapeAlert[32]: Interface: Problem with SCSI interface between tape drive and initiator. MinBlock:2 MaxBlock:16777214 SCSI ID: 0 SCSI LUN: 0 Ready: yes BufferedMode: yes Medium Type: 0x85 Density Code: 0x1b BlockSize: 0 DataCompEnabled: yes DataCompCapable: yes DataDeCompEnabled: yes CompType: 0x10 DeCompType: 0x10 BOP: yes Block Position: 0 /usr/local/sbin/mtx -f /dev/sg1 unload 1 0 Unloading Data Transfer Element into Storage Element 1...done /usr/local/sbin/tapeinfo -f /dev/sg0 Product Type: Tape Drive Vendor ID: 'QUANTUM ' Product ID: 'DLT7000 ' Revision: '2560' Attached Changer: No SerialNumber: 'CX929S1439' MinBlock:2 MaxBlock:16777214 SCSI ID: 0 SCSI LUN: 0 Ready: no #--------------------------------------------- # DLT man pages: mtx, mt, tapeinfo -suppliment to mt loaderinfo -syntax loaderinfo -f /dev/sg0 /dev/sg1 scsitape -suppliment to mtx, has some cool options. ################################################## # Bring it all together ################################################## /bin/mt -f /dev/nst0 stat /bin/ mt -f /dev/nst0 offline /bin/mt -f /dev/nst0 stat /usr/local/sbin/mtx -f /dev/sg1 unload 1 0 /usr/local/sbin/mtx -f /dev/sg1 status /usr/local/sbin/mtx -f /dev/sg1 load 6 0 /usr/local/sbin/mtx -f /dev/sg1 status /bin/mt -f /dev/nst0 stat /bin/ mt -f /dev/nst0 offline ############################ # check the status of dlt: ############################ /usr/local/sbin/mtx -f /dev/sg1 status Storage Changer /dev/sg1:1 Drives, 8 Slots ( 0 Import/Export ) Data Transfer Element 0:Full (Storage Element 1 Loaded) Storage Element 1:Empty Storage Element 2:Full Storage Element 3:Full Storage Element 4:Full Storage Element 5:Full Storage Element 6:Full Storage Element 7:Empty Storage Element 8:Empty ############################ # write my home dir to the tape and then rewind ############################ tar -cf /dev/st0 /home/jstile ############################ # forward space 1 file ############################ mt -f /dev/nst0 fsf 1 mt -f /dev/nst0 status SCSI 2 tape drive: File number=1, block number=0, partition=0. Tape block size 0 bytes. Density code 0x1b (unknown to this mt). Soft error count since last status=0 General status bits on (81010000): EOF ONLINE IM_REP_EN ############################ # WorkGroup Backup #2 # # there is a cocument where # i sed the output of a backup # of sfdev1, parallel, and sfntsever. # # question is, where is the script? # Found it: /home/qix/daily.backup # creates files in var: # # ###########################