Linux Tape Backup

From Dave-Wiki
Jump to navigation Jump to search

Linux Drivers

LSI SAS2008

My first obstacle was getting the drive to show up in Linux. Apparently RHEL/CentOS decided to stop putting LSI SAS2008 (SAS9200-8e) drivers in the distro, starting with RHEL/CentOS8. Here's some more info: https://access.redhat.com/discussions/3722151 Also a helpful vid: https://www.youtube.com/watch?v=4fOAuXiynYM

I was able to get the correct drivers for my LSI SAS9200-8e using the driver that matched my kernel (CentOS Stream 8/4.18.0-448.el8.x86_6) here: http://mirror.centos.org/centos/8-stream/kmods/x86_64/packages-rebuild/Packages/k/ (I used kmod-mlx4-4.18.0~448-1.el8s.x86_64.rpm).

Also, FWIW, I'm using a Quantum Ultrium LTO 4 (Model B) SAS Tape Drive attached to a LSI SAS9200-8e. I'm using a fresh install of CentOS Stream 8 on a Dell PowerEdge R730xd.

LSI SAS3008 / Dell 12Gbps HBA

I have since switched to a LSI SAS3008 PCI-Express Fusion-MPT SAS-3 (branded as a Dell 0T93GD 12G SAS HBA Low Profile Dual Port Host Bus Adapter) and the card just worked out of the box with RHEL 9.3 (it is using the built-in mpt3sas kernel driver). I'm still using the Quantum Ultrium LTO 4 (Model B) SAS Tape Drive, mounted in a 2U Dell PowerVault 114X enclosure.

Using The Tape Drive In Linux

The main program we will use is called mt. You can install it by running sudo yum install mt-st (or equivalent command for your distro).

Device Names

The device name you utilize affects behavior after command executions:

/dev/st0
rewinds tape after being written to
/dev/nst0
don't rewind tape after being written to

More info: https://forums.fedoraforum.org/showthread.php?59746-SCSI-Tape-Drive

Operations

Check if tape is online

mt -f /dev/st0 status

A cartridge is inserted and ready to write. Because we used /dev/st0, the tape rewound itself after executing the command, and is now positioned at the beginning.

List The First file

file - < /dev/nst0

Example Output: blah

Forward Tape To Next File

mt -f /dev/nst0 fsf 1

Seek To A File On The Tape

mt -f /dev/nst0 asf {file_number}

File numbers start at zero (0).

Write Directory To Tape, At Current Position

tar cvf /dev/nst0 {directory}

or, you can also write the file list to a file so you have a record of files:

tar cvf /dev/nst0 {directory} | tee {listing.txt}

Rewind The Tape

mt -f /dev/nst0 rewind

List The Files In The Current Tar File

Make sure you move to the tar file you want, first

tar tf /dev/nst0

or, you can also write the file list to a file so you have a record of files:

tar tf /dev/nst0 | tee {listing.txt}