Commands

Finding the Auto-Loader Device

    lsscsi -g

    EXAMPLE:

    [0:0:0:0]    disk    ATA      ST4000VN008-2DR1 SC60  /dev/sda   /dev/sg0 

    [1:0:0:0]    disk    ATA      ST4000VN008-2DR1 SC60  /dev/sdb   /dev/sg1 

    [4:0:0:0]    disk    ATA      ST4000VN008-2DR1 SC60  /dev/sdc   /dev/sg2 

    [5:0:0:0]    disk    ATA      ST4000VN008-2DR1 SC60  /dev/sdd   /dev/sg3 

    [9:0:0:0]    tape    HP       Ultrium 6-SCSI   35PW  /dev/st0   /dev/sg4    

    * USE THIS DEVICE WITH COMMAND mt


    [9:0:0:1]    mediumx HP       1x8 G2 AUTOLDR   5.10  /dev/sch0  /dev/sg5
    * USE THIS DEVICE WITH COMMAND mtx

    [10:0:0:0]   disk    Seagate  BUP BK           0304  /dev/sde   /dev/sg6 

MT | Tape Commands

SHOW TAPE STATUS

mt -f /dev/st0 status

REWIND TAPE

mt -f /dev/st0 rewind

RETENSION TAPE

mt -f /dev/st0 retension

ERASE ENTIRE TAPE

mt -f /dev/st0 erase

GO FORWARD ONE SESSION MARK

mt -f /dev/nst0 fsf $mark

GO BACK ONE SESSION MARK

mt -f /dev/nst0 bsf $mark

SKIP TO END OF MARK (LAST DATA WRITTEN ON TAPE)

mt -f /dev/nst0 eom

MTX | Auto-Loader Commands

SHOW AUTO-LOADER INVENTORY STATUS

mtx -f /dev/sg5 status

LOAD SLOT X TAPE

mtx -f /dev/sg5 load $tape_number

UNLOAD SLOT X TAPE

mtx -f /dev/sg5 unload $tape_number

LOAD NEXT TAPE

mtx -f /dev/sg5 next

LOAD PREVIOUS TAPE

mtx -f /dev/sg5 previous

LOAD FIRST TAPE

mtx -f /dev/sg5 first

LOAD LAST TAPE

mtx -f /dev/sg5 last

MOVE TAPE FROM SLOT X TO Y

mtx -f /dev/sg5 transfer $x $y

SWAP TAPES FROM SLOTS X AND Y

mtx -f /dev/sg5 exchange $x $y

TAR | File Archive Commands

WRITE FILES TO CURRENT TAPE SESSION

tar cvf /dev/nst0 $FILENAME

APPEND FILES TO THE END OF CURRENT SESSION

tar rvf /dev/nst0 $FILENAME

LIST FILES FROM CURRENT SESSION

tar tvf /dev/nst0 $FILENAME

EXTRACT FILES FROM CURRENT SESSION

tar xvf /dev/nst0 $FILENAME

EXAMPLE: DELETING TAPES 1-4

declare -a tapes=("1" "2" "3" "4")

echo "Erasing and Re-Tensioning Tape."

for i in "${tapes[@]}"
do

echo "Loading Tape $i"

mtx -f /dev/sg5 load "$i"
echo "mt -f /dev/st0 rewind"
time mt -f /dev/st0 rewind

echo "mt -f /dev/st0 retension"
time mt -f /dev/st0 retension

echo "mt -f /dev/st0 erase"
time mt -f /dev/st0 erase

echo "mt -f /dev/st0 rewind"
time mt -f /dev/st0 rewind

echo "mt -f /dev/st0 status"
mt -f /dev/st0 status

echo "mtx -f /dev/sg5 unload"
mtx -f /dev/sg5 unload

echo "Done."

done