Using Tape Drives



next up previous contents index
Next: PC Floppy Diskettes Up: Reading and Writing Previous: Reading tar Archives

Using Tape Drives

While tape drives are the slowest way to store data, they are still and also the most economical for large numbers of data. For this reason we recommend you use tapes to back up your files and your system. Cartridge tapes have made tapes more convenient and less expensive than the old reel systems, yet they are still used in much the same manner. To use your tape drive, you need to know what name your operating system has assigned to it and the system's tape control commands for things like rewind and fast forward.

Two different tape cartridges are widely used on Unix machines today. The 1/4-inch cartridge tape is approximately 6 x 4 x 0.5 inches in size. Its two standard formats, QIC-120 and QIC-150, hold up to 120 MB and 150 MB of data, respectively. Most tape drives can read both formats and will automatically switch to the proper one when reading a tape. However, if you are writing a tape to be read on an older drive, you may want to check your manual to see if you can use a special device name to write to the older QIC-120 format.

A newer tape cartridge is the 8-mm tape. This holds 20-40 times more data than a 1/4-inch cartridge and is inexpensive since it is the tape used in home video recorders. It is, however, quite slow. The most common format for 8-mm tapes hold 2.3 GB of data, yet many manufactures are incorporating data compression schemes into their drives to increase the capacity to over 5 GB.

The Unix designation for a tape drive is different on almost every system. Worse yet, different functions on the drives, such as reading at a specific density, are treated as different devices. The default is usually for cartridge tapes to rewind when a tar or other operation has completed. If you want to write several archives to a tape, you will want to override this behavior-else successive archives will be written on top of each other and only the last one will remain. To avoid overwriting, override the default by specifying the tape drive as one which does not rewind after it writes (even though it is physically the same drive as the default). Names of tape devices on a few common systems are:


UNIX TAPE DEVICES
Sun OS
/dev/rst0
Tape drive 0.
/dev/nrst0
Tape drive 0 without auto rewind.
SCO
/dev/rct0
Tape drive 0.
/dev/nrct0
Tape drive 0 without auto rewind.
SysV
/dev/rct/0
Tape drive 0.
/dev/rct/0n
Tape drive 0 without auto rewind.
AIX
/dev/rmt0
Tape drive 0.
/dev/rmt0.1
Tape drive 0 without auto rewind.
BSD
/dev/rst0
Tape drive 0.
/dev/nrst0
Tape drive 0 without auto rewind.

The command for controlling the tape drive is often mt but may also be cmt, tctl, or just tape:

% mt -f /dev/rst0 erase   	Erase the tape in tape drive 0.   


OPTIONS FOR mt
-f tapedrive
Name of the drive.
fsf n
Skip past n archives.
bsf n
Skip back n archives.
eof
Place an end of file EOF mark on tape.
rewind
Rewind the tape.
retension
Exercise the tape.
erase
Erase the entire tape.

Retensioning a tape prevents damage by stretching new tapes and by exercising old ones. It is particularly useful with 1/4-inch tape cartridges and is done automatically on some systems. (If your tape drive is taking a long time to initialize itself, this is probably what it's doing.)

The simplest way to use a tape is to place a single archive on each tape. This is common, but if you need to archive large amounts of data from separate file systems, you may want to write more than one archive to the same tape. This is done by using the name of the tape drive which refers to the ``no rewind'' device so that archives are written one after another and not one on top of another. Each tar command will then write a separate successive archive to the tape. To read the archives back, use the ``no rewind'' device name again and the mt command to skip past archives you don't want to read.



next up previous contents index
Next: PC Floppy Diskettes Up: Reading and Writing Previous: Reading tar Archives