Tape Archive Basics

Description

A Tape Archive facility is available at the Computer Graphics Lab (CGL). This lab is run by Scientific Computing and Visualization, a division of Information Technology. Our services are available to the entire Boston University community. In order to utilize our tape archive facility, you must purchase a magnetic tape of the appropriate type (see below) and bring it in with you to the CGL. You must also have an account on the tape drive-equipped machine you wish to use. There is no additional charge beyond the cost of the tape for this facility but it is a self-serve system. If you have difficulty, ask the Graphics Consultant on duty for help.

Available SCV supported machines for producing tape archives (Table - click here if it does not look right in your browser)

Machine Device Name Default Dev. Tape Type Tape Size
Squid /dev/exabyte
/dev/exabytenr
NONE Exabyte 8mm 2 Gigabytes
Grizzly /dev/exabyte
/dev/exabytenr
/dev/exabyte Exabyte 8mm 2 Gigabytes
Dugout /dev/tape
/dev/tapenr
/dev/tape 1/4" D6150
1/4" D600A
150 Megabytes
60 Megabytes

In the table above, two drive names are listed for each machine. If you use the first drive name the tape will automatically rewind to the beginning after it performs your operation. Using the second drive name (the nr version) will tell the drive not to rewind after your operation. However, you will almost always want to use the first drive name, the rewinding version.

Overview of Tape Archiving

You will wish to create a tape archive of your files if, either, you don't have enough room to store your files on a machine's hard disk or you wish to backup your files for long-term storage such as when you leave the university. The most common command under Unix for dealing with tapes is tar, the tape archiver. This document explains the use of tar for both saving files to tape and restoring them from tape.

Other useful commands under Unix for dealing with tapes are cpio and dd. Of these, dd is mentioned briefly in this document and cpio is not addressed.

Creating a tar tape: Usage and Examples

Tar command usage:

     tar [ - ] c|r|t|u|x [ bBefFhilmopvwX014578 ] [ tarfile ]
          [ blocksize ] [ exclude-file ] [ -I include-file ]
          filename1 filename2 ...  -C directory filenameN ...
Type man tar for more detailed information.

Simple create examples:

To create (which you can think of as copying) verbosely the directory 'temp' on the default device, which is usually the tape device:

    grizzly% tar cv temp

To create the current directory on file(or device in this case) /dev/exabytenr (an exabyte tape drive which will not rewind.):

    squid% tar cf /dev/exabytenr .

To create verbosely the directories /usr1/scv/jack and /usr1/scv/jill, and the file smit.log on the file backup.tar (assumed to be done while in the root directory such as after typing cd /):

    squid% tar cvf backup.tar usr1/scv/jack usr1/scv/jill smit.log

Simple extract commands:

To list the table of contents on the tape drive on squid (very useful):

    squid% tar tf /dev/exabyte

To extract verbosely all the files on the default device which is usually a local tape drive:

    grizzly% tar xv

To extract all the files in ~jack/backup.tar. Tar will not display what it is doing:

    squid% tar xf ~jack/backup.tar

As above, to extract all the files in ~jack/backup.tar but doing it in an alternate way using cat and a pipe(|). Also the verbose option has been turned on so tar will let you know what is happening:

    squid% cat ~jack/backup.tar | tar xvf -

If you have multiple tar archives on a single tape, extracting files is somewhat more cumbersome.
To extract the entire third tar archive on a tape in Squid's drive, do the following. The mt command tells the drive to go forward 2 tape archives and then not rewind. After that you can simply extract the files. Type man mt for more information on this tape manipulating program.

    squid% mt -f /dev/exabytenr fsf 2
    squid% tar xvf /dev/exabyte

Complex Tar Commands:

Do not use any of these commands unless you really understand what you are doing. Get help if you are not sure.

The following command 1)Tars up /usr1/scv/jack, /scratch, and /scratch2; 2)Pipes the output to compress; and 3)Redirects the output to the file 'file.tar.Z'. The - symbol in the place of a file name causes tar to write to standard output (the screen if not for the pipe symbol [ | ]) rather than to a file or device.

    squid% tar cvf - usr1/scv/jack scratch scratch2 | compress > file.tar.Z

The following command will uncompress the tar archive ~jack/file.tar.Z; cd to /scratch/jack and extract verbosely all the files in the archive. The result will be that all the files in the compressed archive file.tar.Z will be extracted into the directory /scratch/jack.

    squid% zcat ~jack/file.tar.Z | (cd /scratch/jack; tar xvf -)

The following command will copy the files from the directory usr1/scv/jack on the local host and extract them verbosely into cgl's /scratch/jack directory. You would need to do something like this if you wished to backup files on a different machine than the tape drive is on. For this command or any command using rsh to work, you must have a .rhosts file setup on the remote machine allowing access from the local machine (user jack would need a .rhosts file on cgl with a line squid.bu.edu jack in it). Before doing a command like this try doing rsh cgl date to make sure your permissions are set correctly.

    squid% tar cBf - usr1/scv/jack | rsh cgl '(cd /scratch/jack; tar xvBf -)'

To copy the directory ~jack onto grizzly's tape device using dd, use the following command. This command is appropriate for when your files are on one machine but the tape drive is on a different machine. Note that dd is somewhat architecture-dependent. If you have problems, ask the consultant in the Computer Graphics Lab for help or send mail to help@cgl.bu.edu.

    cgl% tar cBvf - ~jack | rsh grizzly dd bs=20b of=/dev/tape

To extract the source files from the tar file created in the previous command into the correct directory do the following. Use this command when you wish to extract files onto a machine different from the machine with the tape drive.

    cgl% rsh grizzly 'dd bs=20b if=/dev/tape' | tar xvBf -

To write a third tar archive onto a tape that already has two archives on it (on Grizzly):

    grizzly% mt -f /dev/exabytenr fsf 2  (Go forward 2 EOF's.  Don't rewind.)
    grizzly% tar cvf /dev/exabytenr file1 dir1 (Tar file1 + dir1 onto tape).

Common Issues/Problems

  1. New tapes can be purchased from the IT Supply Store, run by the Office of Information Technology at 111 Cummington Street. As of July 19, 1995, the Exabyte 8mm tapes are listed as "8MM VIDEO CASSETTE TAPES" and cost $19 whereas the 1/4" D600A and D6150 tapes are listed respecitvely as "CARTRIDGE DC600" and "CARTRIDGE DC6150" and each cost $25.
  2. Do not type ctrl-c to try to interrupt the drive in the middle of a command. The drive is very likely to hang on you. Once this happens, the tape drive will be unusable by you and all other users and the system will have to be rebooted. Be patient and let it finish normally.
  3. Do not use full pathnames when tarring files or directories. In other words, never directly tar a file or directory using the form /path/directory or /path/file. If you do, when the files/directories are extracted they will try to be in the same full pathname location on the machine you extract them on, overwriting existing data.
    Examples of Correct Usage
  4. Tar files generated on some machines can not be read by our drives. Hewlett-Packard(HP) tapes in particular commonly can not be handled by our drives/software.
  5. Placing multiple tar archive files on a single tape is somewhat complicated. If you really need to get multiple archives on a single tape you can do one of two things. 1)Extract the archive presently on the tape onto your machine and then re-tar the files from that archive along with the new files you wish to backup into a single tar file on the tape (this will only work if there is only one tar archive on the tape to begin with). 2)Ask for expert help.
  6. If you wish to extract only individual parts of a large archive you must give the full names of each item you wish to extract.
        grizzly% tar tv (List files and directories on default device (tape))
        tmp
        tmp/jay.gif
        tmp/jay.ps
        etc
        etc/motd
        grizzly% tar xv tmp/jay.gif (Extract file jay.gif.)
                         OR
        grizzly% tar xv tmp (Extract directory tmp (including jay.gif and jay.ps.))
        		     OR
        grizzly% tar xv tmp/jay.ps etc (Extract file jay.ps and directory etc)
    

    Document Name: tapearchive
    Author/Maintainer: Aaron D. Fuegi (aarondf@bu.edu)
    Keywords: tar, tape, exabyte, archive, backup
    Machines List: squid, grizzly, dugout
    Related Man Pages: tar, mt
    Created April 20, 1995; Last Revised July 19, 1995; Last Modified
    URL of this document: http://scv.bu.edu/SCV/help/tapearchive.html
    Go up to SCV Hardcopy and Production Services