Backups to Tape on Linux

Backups to Tape on Linux

NOTE: The NRAO will stop support for tape drives on the desktop by the end of 2016

See this memo for more details.

Do-It-Yourself Tape Backups

There are three ways you may be able to back up your files to tape on a Unix system. In the examples here, valen is used as the system with the tape drive, and the Linux form of tape device name is used (/dev/nst0). On Solaris, device names look like /dev/rmt/0ln. In all cases, the zero indicates the first tape drive, 1 the second and 2 the third.  Check labels on drives, or ask if you're not sure.

Backups on Linux

1. Local Tape Drive: If you have a tape drive on your workstation, just use tar like so: tar cvf /dev/nst0 . (use /dev/rmt/0ln for Solaris). This backs up the current directory and all subdirectories.
2. Remote Tape Drive via GNU tar: If you do not have a tape drive, the best option is to use GNU tar to access the tape drive remotely: tar cvf valen:/dev/nst0 . Backs up current directory to the device on remote system "valen". (use gtar or /opt/local/bin/tar for Solaris).
1. For example on any Linux machine:
1. LinuxMachine% cd /home/computerName (Change to the directory you want to back up)
2. LinuxMachine% mt -f /dev/nst1 rewind (Rewind the tape)
3. LinuxMachine% tar -cvf /dev/nst1 . (Write files to tape using no-auto-rewind device name)
4. LinuxMachine% mt -f /dev/nst1 rewind (Rewind the tape)

Note that you could redirect the output of the table of contents listing into a file, or pipe it into a printing command or a screen-pager program like less.  That way you could make it easier to read through, or save it permanently.

LinuxMachine% tar -tvf /dev/nst1 > ~/tape.list

3. Remote Tape Drive if GNU tar is not an option: (it should work), use this recipe instead: ( tar cfBb - 20 . ) | ssh valen 'dd of=/dev/nst0 bs=20b'

NOTE: do not add the verbose flag (v) to the tar options on this command; the standard output is used as the output and any messages will end up corrupting the resulting tape archive! In any event, check your tape with a "tar tvf after writing in this manner in case there were problems.

Any of these should work considerably faster than the fourth, unmentioned alternative: using NFS on the machine with the tape drive to access the disk you want. While this works, it is very noticeably slower.

If you do not want to back up the whole current directory and all subdirectories, you can specify a list of files to choose, e.g.,

tar cvf /dev/nst0 image.fits Mail/*.bak

which backs up the file image.fits, and all files matching *.bak in the Mail subdirectory.

If you are using GNU tar (on Linux, tar is GNU tar), you can automatically compress or "gzip" the tape by adding a z to the options in the examples, e.g., tar zcf. Do not try this on BITPIX=-32 FITS files (floating point); the compression algorithm works best on 8 or 16 byte integer entities, not 32 bit floating point format.

Older DDS-2 and Exabyte tape drives write at about 20 Mbytes a minute. DDS-3 drives are quite a bit faster, and the DDS-4, DLT, VXA, and Exabyte Mammoth are capable of up to 3 Megabytes per second -- if the disk is fast enough! It is prudent to re-direct the output of your session to a file for reference, in case you need to restore files later.

Backups on Solaris

Remote Tape Drive via GNU tar:

1. SolarisMachine% cd /home/computerName (Change to the directory you want to back up)
2. SolarisMachine% mt -f /dev/rmt/1ln rewind (Rewind the tape)
3. SolarisMachine% tar -cvf /dev/rmt/1ln . (Write files to tape using no-auto-rewind device name)
4. SolarisMachine% mt -f /dev/rmt/1ln rewind (Rewind tape)

Note that you could redirect the output of the table of contents listing into a file, or pipe it into a printing command or a screen-pager program like less. That way you could make it easier to read through, or save it permanently.

SolarisMachine% tar -tvf /dev/rmt/1ln > ~/tape.list

...And how to Restore it

First, check what's on the tape:

tar tvf /dev/nst0 | less

(Add a "z" after the "tvf" if you know data on the tape was gzipped). Once you've decided what you want off the tape, you specify exactly which file or directory/ies you want:

 mt -f /dev/nst0 rewind tar xvf /dev/nst0 Mail/purplefiles.bak

It's important you specify the names exactly as they appear in the "tvf" listing; use a leading dot slash if one appears. If you request a directory, it and its contents will be recursively restored.

Types of Tape Drive

There are four main types of tape drive that are useful as backup and data interchange devices from the Unix systems at NRAO/Charlottesville. Within each of these, there may be various subtypes; for example, there are four subtypes of 4mm DDS drive, each with different native capacity. The table below summarizes the formats.

Drive Type Subtype Capacity/GBytes
(uncompressed)
Notes
AIT AIT-3 110 Fastest and most capacity of any tape drive. Expensive media ($80 per cartridge). DLT 2000 10.0 Digital Linear Tape. No 2000 or 4000 models yet in NRAO; can emulate this format with DLT 7000 (see below) 4000 20.0 7000 35.0 One of the fastest drives we have (3+ Mbytes/sec); cartridges$80 each!
DDS DAT (4mm) DDS-1 2.0 90m cartridge
DDS-2 4.0 120m cartridge
DDS-3 12.0 125m cartridge
DDS-4 20.0 150m cartridge
Ecrix VXA-1 33.0 170-meter cartridge (may be marked V17); cost $80 or more each 12.0 60-meter cartridge (may be marked V12); cost around$35 each
Exabyte (8mm) 8200 2.3 The original Exabyte.
8500 5.0 "High density" mode; emulates 8200 in low density mode.
8700 7.0 Need an Eliant tape drive and long (160m) tape cartridge for this.
8900 20.0 "Mammoth"; only use (gray) mammoth tapes in this!!!! 2.7Mbytes/sec.
9-Track 6250 0.14 Tape drive is no longer available.

NOTES:

1. For reading, you should use the low density, uncompressed device name in general. Most drives will read what's on the tape at the correct density and compression setting. For writing, you have to specify the right device name for the density you want (if relevant).
2. On Linux, you use the mt setdensity command to change the density if you wish to write at some setting other than the default density. Multiple densities is only relevant for Exabyte 850x, 9-track and DLT drives (and we hope you are not going to use the 9-track to write anything!!!).
3. The new VXA drive will not accept Exabyte 8mm cartridges. It will summarily spit them back at you.
4. For writing, the density for DDS DAT drives is set by the media. If you use a 120m tape on a DDS-2 or DDS-3 drive, you will have 4Gbytes of space; if you use a 90m tape, you'll only be able to put 2Gbytes on it. This is different than the situation for other formats, where software sets the density.
5. Cartridge\DriveCapacity DDS-1DDS-2DDS-3DDS-4
60-meter 1.2 GB RW RW RW R
90-meter 2 GB RW RW RW R
120-meter 4 GB - RW RW RW
125-meter 12 GB - - RW RW
150-meter 20 GB - - - RW
On DDS DAT drives, the table on the right shows the functionality for various drives with various length of tape. Here RW indicated read and write ability, R indicates readonly ability, and a - (hyphen) indicates you can't use that cartridge in that tape drive. If you go against this table, the drive may spit the tape back at you, or possibly give a "write protected" error.
6. You should never use video or audio quality media in the DDS or Exabyte drives. Only use data certified cartridges for 8mm and 4mm drives; the latter will have the DDS-n logo and the former will have "Computer Grade" or similar markings.

Compression

Many of our drives support compression. This is a feature where the digital electronics in the drive itself will compress the data prior to recording it. While this is useful for backups, it is not particularly desirable for data interchange, or if you may have to use a different, perhaps less capable or incompatible drive, to restore from. Therefore, we recommend that you either use compression with caution, or not at all.

There are no industry-wide standards for compression in tape drives at this time.