UNIX tape duplicator request

Mike Muuss mike at BRL.MIL
Thu Mar 28 12:35:28 AEST 1991


Your "neat trick" is a rather dangerous piece of advice, because it
ignores the issue of tape record lengths.

The copy() subroutine in /bin/cp for BSD UNIX uses a buffer of size:

/usr/include/sys/param.h:#define        MAXBSIZE        8192

in a loop of the general form:

        for (;;) {
                n = read(fold, buf, sizeof buf);
                if (write(fnew, buf, n) != n) {
                        Perror(to);
                }
        }

If you tape has records of 8k or less, and only one "file" (i.e., nothing
following the first EOF marker), then using "cp" will work.

If you know the record length of the tape, you might consider using DD, e.g.:

	dd if=/dev/raw_input of=/dev/raw_output bs=10k

Since TAR tapes are usually written with 10k records, this DD will work,
and your example with CP will produce a defective copy (with most tape
drives/drivers).

If you don't know much about the format of the tape, a still better
command to use is TCOPY (/usr/ucb/tcopy), which will copy tapes that
have varying record lengths, multiple "files" before tape-EOF (double tape-
mark).  It can also be used to "survey" a tape;  it produces a report
like this:

tcopy /etc/passwd
file 1: record 1: size 14608
file 1: eof after 1 records: 14608 bytes
eot
total length: 14608 bytes

	Best,
	 -Mike



More information about the Comp.unix.wizards mailing list