Making Tape-to-Tape Copies
Packey P. Velleca
Quarter Inch Cartridge (QIC) tapes have many formats,
others, from QIC-24 to QIC-525. These formats specify
a standard for
recording data on tape with a fixed block size, generally
QIC formats differs in this regard from 8mm or 9-track
are variable record length (block size) recording devices.
discusses some of the details involved in copying fixed
QIC) tapes, and presents a program capable of copying
one QIC tape
Why a Tape-to-Tape Copy?
Tape copying is useful for several purposes. Many vendors
software on QIC tape, and making backups of these is
good idea. If you use the vendor copy to load machines,
the tape will fail, and you will be forced to wait for
to send another. Another use is in a software production
where engineering can cut one tape of a product, and
can use that tape as the master for generating multiple
A third use for tape copying is to convert the tape
format or distribution
medium. Vendor software is often supplied in a slow,
such as QIC-24 or QIC-150. If your tape drives support
you can make your working copy of the software on a
(Typically, QIC-320 tapes load twice as fast as QIC-150
your vendor may supply software in one medium (e.g.,
TK-50), while you prefer to load your machines with
(e.g., QIC), perhaps to decrease load time. It is easy
to use tape
procedures to copy from one type of media to another.
A common alternative to tape-to-tape copying is to copy
tape to another device, such as a large hard disk, and
then copy the
data from the drive to another tape. While a tape-disk-tape
do in a pinch, it does not make good use of your system
It is twice as slow as tape-to-tape copy (tape to disk,
to tape), and can require significant disk space. A
minimizes time and resource usage. The only requirement
is for a system
with two or more tape drives.
Tape-to-Tape Copy Issues
With fixed block size devices, all tape operations are
of the block size. A file that is smaller than the block
size or a
block size multiple must be padded out, usually with
For example, to write a 300-byte file to a QIC-150 tape,
pad the file to 512 bytes. File padding is normally
as it is usually done by the application program, as,
tar(1), cpio(1) and dump(8). It is only with
programs like dd(1) that you must be careful about padding
when writing files directly to tape. Table 1 presents
a list of commonly
used formats and their capacities.
Padding is not an issue when you are writing files from
block device to another, because you can assume the
data on the source
tape has been written correctly (i.e., padded if necessary).
on the source tape can be of any format -- tar(1), cpio(1),
dump(8) or dd(1) for example -- and copying from
one tape to another is a simple matter of transferring
bits from one
device to another. The remaining concerns related to
have to do with ensuring that the drives stream for
specifying the read/write format, and determining the
number of files
on a tape.
Streaming on a tape drive signifies that the device
is never waiting
for data to read or write. Streaming optimizes device
use and reduces
waiting time. The buffering provided by dd(1) makes
it easy to set up tape streaming when performing a tape-to-tape
By setting dd's bs argument to some large
multiple of the device block size, you can make the
I have found that bs=10k (or more) will allow most QIC
In tape-to-tape copying you must read the source tape
in some format,
A, and write that data to a destination tape in some
B, where A and B do not necessarily have to be
the same. It is possible to copy a QIC-24 tape to a
QIC-320 tape (assuming
your tape drive can support QIC-320) to allow faster
as fast) data transfer rates. Generally, though, tape-to-tape
involves reading and writing in the same format, and
this can simplify
matters for the uninitiated. In this instance, the copy
is only a
matter of reading the source tape format -- a feature
automatically by almost all tape drives.
Determining the destination tape write format is not
automatic, because the device assumes you know which
format you want
to write, and because it is possible to write many formats
You can determine the number of files on a tape automatically
reading files until an EOT marker or the last EOF marker
In either case, the device will return a read-fail status.
Description of the Script
The ksh(1) script in Listing 1 (tape2tape) copies
one QIC tape to another, with no operator intervention.
assumes the platform is configured with at least two
The drives do not have to be the same device type --
be a QIC-320 drive, for example, and the other a TK-50.
When you execute the script, it will assert its default
input device, output device, number of files to copy,
block size, and prompt you to change them. When that
is done, it will
check the status of the tapes (e.g., ONLINE, WRITE PROTECT,
rewind them, and begin the copy.
If you invoked the script with no arguments, then it
assumes the number
of files on the source tape is unknown and copies files
until it encounters
End Of Tape (EOT). At this point, if checksums are to
it rewinds both tapes, and performs a file-for-file,
checksum comparison. Otherwise, it simply rewinds the
tapes and terminates.
If you know the number of files, you can specify the
number on the
command line as an option. You can also use this option
to copy, say,
only the first of many files on a tape.
The script automatically determines tape formats. It
finds the source
tape format via the device driver upon reading. It finds
tape format by making writes, at successively lower
to the destination tape. The first successful write
is the default
The default device files for this script are /dev/nrmt0h
/dev/nrmt1h (if your system uses different device file
then change them at line 38). dd(1) uses these arguments
as input and output files. On most systems, the special
file for the
tape drive denotes the format of the tape operation.
with DEC Ultrix, /dev/rmt0h is QIC-320, rmt0m is QIC-150,
rmt0l is QIC-120, and rmt0a is QIC-24. Consult your
system manual for the file names for the supported formats
tape drives. See Table 2 for other tape characteristics.
The default block size is 10k as denoted on line 306.
also uses this argument to specify input and output
block size. As
I noted earlier, 10k should work well if your device
If not, try 8k instead. Just remember to keep the number
order to keep the drives streaming.
If you invoke the program with the -c option, it will
its default checksum setting. For example, if the default
is TRUE, the -c will not perform checksums. The default
checksum setting is configurable on line 45.
About the Author
Packey Velleca currently works with a group of administrators
for a small system of real-time computers with UNIX-based
workstations. He graduated from Florida Institute of
Melbourne, FL, with a BSEE in 1988. He has published
several articles in Sys
Admin. He may be contacted as email@example.com.