Previous Table of Contents Next


Retensioning a Magnetic Tape

If errors occur when reading a tape, retension the tape, clean the tape drive, and then try again. Type mt -f /dev/rmt/n retension and press Return. The tape in the tape drive you specify is retensioned.

In this example, the tape in drive /dev/rmt/1 is retensioned:

oak% mt -f /dev/rmt/1 retension
oak%

Rewinding a Magnetic Tape

To rewind a magnetic tape, type mt -f /dev/rmt/n rewind and press Return. The tape in the tape drive you specify by the device number n is rewound.

In this example, the tape in drive /dev/rmt/1 is rewound:

oak% mt -f /dev/rmt/1 rewind
oak%

Showing the Status of a Magnetic Tape Drive

To show the status of a magnetic tape drive, type mt -f /dev/rmt/n status and press Return. Status for the tape drive you specify is displayed.

In this example, there is no tape in drive /dev/rmt /1:

oak% mt -f /dev/rmt/1 status
/dev/rmt/1: no tape loaded or drive offline
oak%

In this example, status is shown for the tape in drive /dev/rmt/1:

oak% mt -f /dev/rmt/1 status
Archive QIC-15Ø tape drive:
   sense key(Øx6)= unit attention   residual= Ø   retries= Ø
   file no= Ø   block no= Ø
oak%

The tar Command

Use the tar command to copy files and directory subtrees to a single tape. The advantages of the tar command are that it is available on most UNIX operating systems and public domain versions are readily available. The disadvantages of the tar command are that tar is not aware of file system boundaries, full path name length cannot exceed 255 characters, it does not copy empty directories or special files such as device files, and it cannot be used to create multiple tape volumes.

The following sections describe how to use the tar command to copy files to a tape, list the files, append the files, and retrieve the files.

Copying Files to a Tape (tar)

Follow these steps to copy files to a tape:

1.  Change to the directory that contains the file you want to copy.
2.  Insert a write-enabled tape into the tape drive.


CAUTION! Copying files to a tape using the c option to tar destroys any files already on the tape. If you want to preserve the files already on the tape, use the r option described in "Appending Files to a Tape (tar)" later.
3.  Type tar cvf /dev/rmt/n filename filename filename ... and press Return. The c (copy) option copies the files you specify, the v (verbose) option displays information about the files as they are copied, and the f (files) option followed by the tape device name specifies where the tar files are to be written. The file names you specify are copied to the tape, overwriting any existing files on the tape.


NOTE:  You can use metacharacters (? and *) as part of the file names you specify. For example, to copy all documents with a .doc suffix, type *.doc as the file name argument. If you specify a directory name as the file name, the directory and all its subdirectories are recursively copied to the tape.
4.  Remove the tape from the drive and write the names of the files on the tape label.

In this example, two files are copied to a tape in tape drive 0:

oak% cd /home/winsor
oak% ls evaluation*
evaluation.doc   evaluation.doc.backup
oak% tar cvf /dev/rmt/Ø evaluation*
a evaluation.doc 86 blocks
a evaluation.doc.backup 84 blocks
oak%

Listing the Files on a Tape (tar)

Follow these steps to list the files on a tape:

1.  Insert a tape into the tape drive.
2.  Type tar tvf /dev/rmt/n and press Return. The t (table) option lists the files you specify, the v (verbose) option displays complete information about the files as they are listed in a form similar to the ls -l command, and the f (files) option followed by the tape device name specifies the device where the tar files are located.

In this example, the table of contents for the tape in drive 0 contains two files:

oak% tar tvf /dev/rmt/Ø
rw-rw-rw-6693/1Ø  44032 Apr 23 14:54 1991 evaluation.doc
rw-rw-rw-6693/1Ø  43008 Apr 23 14:47 1991 evaluation.doc.backup
oak%

Reading from left to right, the first column shows the permissions for the file; the second column shows the UID and GID file ownership; the third column shows the number of characters (bytes) in the file; the fourth, fifth, sixth, and seventh columns contain the month, day, date, and year the file was last modified, and the final column contains the name of the file.

Appending Files to a Tape (tar)

Follow these steps to append files without overwriting files already on the tape:

1.  Change to the directory that contains the file you want to copy.
2.  Insert a tape that is not write-protected into the tape drive.
3.  Type tar rvf /dev/rmt/n filename filename filename ... and press Return. The file names you specify are appended to the files already on the tape in the drive you specify.


NOTE:  You can use metacharacters (? and *) as part of the file names you specify. For example, to copy all documents with a .doc suffix, type *.doc as the file name argument.
4.  Remove the tape from the drive and write the names of the files on the tape label.

In this example, one file is appended to the files already on the tape in drive 0:

oak% cd /home/winsor
oak% tar cvf /dev/rmt/Ø junk
a junk 1 blocks
oak% tar rvf /dev/rmt/Ø
rw-rw-rw-6693/1Ø  44032 Apr 23 14:54 1991 evaluation.doc
rw-rw-rw-6693/1Ø  43008 Apr 23 14:47 1991 evaluation.doc.backup
rw-rw-rw-6693/1Ø     18 Dec 1Ø 11:36 1991 junk
oak%

You can put more than one set of tar files on a tape if you use the n (no-rewind) option as part of the tape device name. For example, type tar cvf /dev/rmt/nn filename. The tape is not rewound after the files are copied, and the next time you use the tape, the files are written at the end of the previous set of files.


Previous Table of Contents Next