tar multi-tape backup script
change_tape.sh
#!/bin/sh
# after tar complete backup command
# tar -v –create –tape-length=1G –file=/dev/nst24 /usr –new-volume-script=/root/change_tape.sh
# mtx -f /dev/sg28 status | grep Full| awk -F: '{print $1}' | awk '{print $3}' > /root/tapelist.txt
mtx -f /dev/sg28 unload `head -1 /root/tapelist.txt` 0
mv /root/tapelist.txt /root/tapelist.txt.orig
sed 1d /root/tapelist.txt.orig > /root/tapelist.txt
rm -f /root/tapelist.txt.orig
mtx -f /dev/sg28 load `head -1 /root/tapelist.txt` 0
For backup
mtx -f /dev/sg28 status | grep Full| awk -F: '{print $1}' | awk '{print $3}' > /root/tapelist.txt
mtx -f /dev/sg28 load 1 0
tar -c -v –tape-length=2G –file=/dev/nst24 /usr –new-volume-script=change_tape.sh
For restore
mtx -f /dev/sg28 status | grep Full| awk -F: '{print $1}' | awk '{print $3}' > /root/tapelist.txt
mtx -f /dev/sg28 load 1 0
tar -x -v –tape-length=2G –file=/dev/nst24 –new-volume-script=change_tape.sh