Categories
Sysadmin

Using tape Library PV114x or other with Linux

It is dead simple, make sure that when you plug in SAS cable the light on the SAS card comes up, I spent hours in struggling on Linux when drives did not appear and finally when i push the SAS connector bit inside all flashes 🙂

You only need a software name mt and tar which most of Linux OS already have.. It works same on Ubuntu and or Centos /Redhat flavours.

Replace /dev/st0 with your actual tape drive name.  Usually it is name like /dev/st0 /dev/st1 and so on ..

Rewind tape drive:

mt -f /dev/st0 rewindBackup

Backup any folder:

tar -czf /dev/st0 /anyfolder

Display list of files on tape drive:

tar -tzf /dev/st0

Restore /anyfolder directory:

 

cd /
mt -f /dev/st0 rewind
tar -xzf /dev/st0 www

Unload the tape:

mt -f /dev/st0 offline

Display status information about the tape unit:

mt -f /dev/st0 status

Erase the tape:

mt -f /dev/st0 erase

You can go BACKWARD or FORWARD on tape with mt command itself:

(a) Go to end of data:

mt -f /dev/nst0 eod

(b) Goto previous record:

mt -f /dev/nst0 bsfm 1

(c) Forward record:

mt -f /dev/nst0 fsf 1

To compare tape backup, enter:

tar -dlpMzvf /dev/st0 /anyfolder

To restore tape in case of data loss or hard disk failure:

tar -xlpMzvf /dev/st0 /anyfolder

Where,

d : find differences between archive and file system
x : extract files from an archive
l : list the contents of an archive
p : ignore umask when extracting files
M : create/list/extract multi-volume archive (multiple tapes)
z : Compress backup using gzip
v : verbosely list files processed
f /dev/st0 : Tape device name
/anyfolder : Backup /anyfolder file system