[comp.sys.sun] problem with using 'dd' to copy 'tar' tapes

sdm7g@dale.acc.Virginia.EDU (Steve D. Majewski) (10/08/90)

In trying to make a copy of a tar tape with dd, the copies don't seem to
be exactly the same as the originals. 

The original, I can loop thru via: "dd if=/dev/nrst0" or "tar -tvf
/dev/nrst0"  and at the end, the tape is properly positioned at the start
of the next file.

Reading the copy, the tape sometimes ends up positioned at the end of the
current file, rather than the beginning of the next. 

  "mt status" shows: 
    Archive QIC-150 tape drive:
       sense key(0x0)= no sense   residual= 0   retries= 0
       file no= 3   block no= 17506

I assume that this has something to do with padding and some magical
combination of "bs=" and "conv=block(,sync?) will fix it. Does anybody
know the right magic ? ( I assume it is padding of blocks on the tape,
because there doesn't seem to be any OTHER problems, but I'm not sure how
to verify it - I don't have room enough to diff 2 copies on disk. ) 

 [  This is on a Sparcstation I / SUN-OS 4.03 / Archive QIC-150 tape ]

 Steven D. Majewski		University of Virginia Physiology Dept.
 sdm7g@Virginia.EDU		Box 449 Health Sciences Center
 (804)-982-0831			Charlottesville, VA 22908

jms@tardis.tymnet.com (Joe Smith) (11/04/90)

In article <1990Oct7.230945.3387@rice.edu> sdm7g@dale.acc.Virginia.EDU (Steve D. Majewski) writes:
>In trying to make a copy of a tar tape with dd, the copies don't seem to
>be exactly the same as the originals. 
>
>The original, I can loop thru via: "dd if=/dev/nrst0" or "tar -tvf
>/dev/nrst0"  and at the end, the tape is properly positioned at the start
>of the next file.
>
>Reading the copy, the tape sometimes ends up positioned at the end of the
>current file, rather than the beginning of the next. 

That's strange.  Every time I've tried reading an original tape with
multiple tar saves, it always stops before the start of next file.  For
instance:

    tar cvf /dev/nrst8 dir1
    tar cvf /dev/nrst8 dir2
    mt -f /dev/nrst8 rew
    tar xvf /dev/nrst8	# restores dir1
    tar xvf /dev/nrst8	# always says "unexpected EOF"
    tar xvf /dev/nrst8	# restores dir2

This matches the man page for tar:

     If there are multiple archive  files  on  a  tape,  each  is
     separated from the following one by an EOF marker.  tar does
     not read the EOF mark on the tape after it finishes  reading
     an  archive  file  because tar looks for a special header to
     decide when it has reached the end of the archive.   Now  if
     you  try  to  use tar to read the next archive file from the
     tape, tar does not know enough to skip over the EOF mark and
     tries  to  read  the  EOF  mark  as an archive instead.  The
     result of this is an error message from tar to the effect:
          tar: blocksize=0
     This means that to read another archive from the  tape,  you
     must  skip  over  the EOF marker before starting another tar
     command.  You can accomplish this using the  mt(1)  command,
     as in "mt -f /dev/nrst8 fsf 1"

So, I can't explain why you luck out on your originals.

Joe Smith (408)922-6220 | SMTP: jms@tardis.tymnet.com or jms@gemini.tymnet.com
BT Tymnet Tech Services | UUCP: ...!{ames,pyramid}!oliveb!tymix!tardis!jms
PO Box 49019, MS-C41    | BIX: smithjoe | 12 PDP-10s still running! "POPJ P,"
San Jose, CA 95161-9019 | humorous dislaimer: "My Amiga 3000 speaks for me."