[comp.unix.wizards] UNIX tape duplicator request

RAPHAEL%s51.prime.com@relay.cs.net (Nick Raphael) (03/26/91)

I'm not a wizard, and can offer only a suggestion.

Investigate the dd command.  That should allow
you to make a byte-for-byte copy.

Nick

--- Your original message :

Subject: UNIX tape duplicator request
To:   info-unix@list.prime.com,
      unix-wizards@list.prime.com
From: Gantt Edmiston  <GED@WUFPAK.Prime.COM>
Date: Tue, 26 Mar 91 10:06:00 EST
Reply-To: UNIX-WIZARDS@BRL.MIL

Hello UNIX literate from one who is not!

I have a need and hopefully someone out there has a solution.

The problem:  The need to duplicate UNIX software on 60 MB data
cartridges.  I have a Prime EXL320 CPU which runs System 5 Version 3.1.2
UNIX.  I can (I have the Hardware) configure two 60 MB tape drives on
the same SCSI chain, if necessary.  (This would allow me to theoretically
do a tape-to-tape copy.)  If it is just as easy to do a
tape-to-disk-to-tape then ok also.  I want to DUPLICATE exactly the data
from the source tape to a blank tape so that they are functionally
identical.

As I stated from the beginning,  I am quite new to UNIX and would
appreciate your help with EXACT steps and procedures.

Thanks, Gantt Edmiston, PrimeService Customer Engineer
GED@WUFPAK.Prime.COM

PHILIP@ucc.uwindsor.ca (Philip Smith) (03/28/91)

Gantt Edminston,

A neat trick for coping tape to tape in Berkeley UNIX is to use the copy
command

 i.e.  cp /dev/TAPE1 /dev/TAPE2

 where TAPE1 is the name of the input drive, and
       TAPE2 is the name of the output drive


Philip Smith
Systems Programmer
University of Windsor

e-mail : PHILIP@UCC.UWindsor.Ca
phone  : (519)253-4232 ext. 3252  or  (313)963-6112 ext. 3252

mike@BRL.MIL ( Mike Muuss) (03/28/91)

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

gwyn@smoke.brl.mil (Doug Gwyn) (03/29/91)

In article <26385@adm.brl.mil> mike@BRL.MIL ( Mike Muuss) writes:
>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 ...

I even wrote a version of "tcopy" that uses double-buffering (with
a pair of interlocking processes).  It was a nice exercise, but due
to apparent serious problems in the magtape device driver on our
only remaining system with two tape transports, it didn't run any
faster than the obvious single-process implementation.  It should
have...

JTUCKER%cs-den.prime.com@relay.cs.net (04/06/91)

Philip,

cp /dev/TAPE1 /dev/TAPE2 works great if TAPE1 is in tar format.  Try it using
an OS tape for TAPE1.

Jeff

friedman@zurich.ai.mit.edu (Noah Friedman) (04/06/91)

In article <26469@adm.brl.mil> JTUCKER%cs-den.prime.com@relay.cs.net writes:
>cp /dev/TAPE1 /dev/TAPE2 works great if TAPE1 is in tar format.  Try it using
>an OS tape for TAPE1.

   cp is sometimes flaky with me.  It seems to be safer to use dd. 


---
Noah Friedman
friedman@gnu.ai.mit.edu