TCOPY(1)

NAME
tcopy - read, write, copy and verify tapes

SYNOPSIS
tcopy [-crvx] [-l logfile] [-s maxblk] [src [dest]]

DESCRIPTION
The tcopy utility is designed to read, write and copy tapes.

The only assumption made about the tape layout is that there are two sequential EOF marks at the end.

The src argument can be a tape device and defaults to /dev/sa0 or it can be data in SIMH-TAP format. If src is “-” the standard input is read.

If the dest argument is also specified, a copy of the src will be made onto the dest. If dest is “-” standard output will be written to.

If dest is a tape device, the file and record structure will be the same.

If dest is a filename ending in “.000” the contents each file on src will be written to sequentially numbered files “.000”, “.001”, “.002” etc. Information about record sizes will be lost.

If the -r flag is specified, only the data will be written, information about file and record layout is lost.

Otherwise the data, file and record structure of src will be written in SIMH-TAP format.

The tcopy utility will report information about the layout of src like this on standard output:

    file 0: block size 80: 6 records
    file 0: eof after 6 records: 480 bytes
    file 1: block size 3072: records 0 to 262
    file 1: block size 612: record 262
    file 1: eof after 263 records: 805476 bytes
    […]
    eot
    total length: 972851280 bytes time: 41 s rate: 22934.8 kB/s

If dest is “-” or if -x is specified this goes to standard error instead, and can also be redirected with -l logfile, in which case the final total line will also be reported on standard error.

If tcopy receives a SIGINFO signal, current counts are reported on standard error.

The following options are available:

-c  Rewind both tapes, copy src to dest, rewind again and verify that the two tapes are now identical.

-l logfile
    Output all informational messages to logfile.

-r  Write only the contents of all data blocks to the output. The file and record structure of the input will be lost.

-s maxblk
    Specify a maximum block size, maxblk. The default is kern.maxphys.

-v  Verify that src and dest are identical. Note that the tapes are not rewound prior to the comparison.

-x  Output all informational messages to the standard error instead of the standard output. This option is automatic if dest is given as “-”.

EXIT STATUS
Unfortunately all over the place, but zero always means succeess.

EXAMPLES
Verify that the tape in /dev/sa0 can be read and see the layout of its content:

    tcopy

Copy a tape using two tape drives:

    tcopy  /dev/sa0 /dev/sa1

Copy a tape using only a single tape drive, and verify the result:

    tcopy /dev/sa0 /tmp/temp.tapfile
    # change tape
    tcopy -c /tmp/temp.tapfile /dev/sa0

Make a cryptographic hash of both the contents and the layout of the tape in /dev/sa1:

    tcopy /dev/sa1 - | sha256

Copy a tape to a tape drive on another machine:

    tcopy /dev/sa0 - | ssh otherhost tcopy - /dev/sa0

Extract the tape files into individual files:

    tcopy /dev/sa0 /tmp/_.tape.000

Ignore all structure on the tape and feed all data to tar(1):

    tcopy -l /dev/null -r /dev/sa0 - | tar tvf -

SEE ALSO
mt(1), sa(4), mtio(4)

STANDARDS
The SIMH-TAP format is documented in the open-simh github repos: https://github.com/open-simh/simh/blob/master/doc/simh_magtape.doc

HISTORY
The tcopy command appeared in 4.3BSD.

BUGS

Modern tape drives may return a SCSI "Incorrect Length Indicator (ILI)" for each read with a different block size that what is on the tape, and that slows tcopy down a lot. This can be disabled with the mt(1) command:

    mt param sili -s 1

End of data (EOD) is determined by two sequential EOF marks with no data between them. There used to be old systems which typically wrote three EOF's between tape files. The tcopy utility will erroneously stop copying early in this case.

With -c the tape drives are not rewound at the same time, but one after the other.