8.3.1. Basic Tape Auto-Loader Commands

How to check which device is the Auto-Loader

        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

Note

/dev/sg5 is the Auto-Loader Device itself, while /dev/sg4 is the tape

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 X
GO BACK ONE SESSION MARK
mt -f /dev/nst0 bsf X
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 X
UNLOAD SLOT X TAPE
mtx -f /dev/sg5 unload X
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