bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GNU dd and GNU tar See Tape Differently.


From: Ralph Corderoy
Subject: GNU dd and GNU tar See Tape Differently.
Date: Thu, 13 Jun 2002 20:32:53 GMT

Hi,

OK, I've put 3 small files onto a non-rewind SCSI tape drive using three
invocations of tar.  If I use dd to read the tape then I read three
files in a row followed by nothing -- that's fine.

    # mt -f /dev/nst0 rewind
    # mt -f /dev/nst0 tell  
    At block 0.
    # dd if=/dev/nst0 bs=10240 | wc -c
    1+0 records in
    1+0 records out
      10240
    # mt -f /dev/nst0 tell
    At block 1.
    # dd if=/dev/nst0 bs=10240 | wc -c
    1+0 records in
    1+0 records out
      10240
    # mt -f /dev/nst0 tell
    At block 2.
    # dd if=/dev/nst0 bs=10240 | wc -c
    1+0 records in
    1+0 records out
      10240
    # mt -f /dev/nst0 tell
    At block 3.
    # dd if=/dev/nst0 bs=10240 | wc -c
    0+0 records in
    0+0 records out
          0
    # mt -f /dev/nst0 tell
    At block 3.
    # dd if=/dev/nst0 bs=10240 | wc -c
    dd: reading `/dev/nst0': Input/output error
    0+0 records in
    0+0 records out
          0
    # mt -f /dev/nst0 tell
    At block 3.

But if I use tar I find a second invocation is required before we
progress onto the next file.  Here's what I mean.

    # mt -f /dev/nst0 rewind
    # mt -f /dev/nst0 tell
    At block 0.
    # tar tf /dev/nst0
    0
    a
    # mt -f /dev/nst0 tell
    At block 1.
    # tar tf /dev/nst0
    # mt -f /dev/nst0 tell
    At block 1.
    # tar tf /dev/nst0
    1
    a
    # mt -f /dev/nst0 tell
    At block 2.
    # tar tf /dev/nst0
    # mt -f /dev/nst0 tell
    At block 2.
    # tar tf /dev/nst0
    2
    a
    # mt -f /dev/nst0 tell
    At block 3.
    # tar tf /dev/nst0
    # mt -f /dev/nst0 tell
    At block 3.
    # tar tf /dev/nst0
    # mt -f /dev/nst0 tell
    At block 3.
    # tar tf /dev/nst0
    tar: /dev/nst0: Cannot read: Input/output error
    tar: At beginning of tape, quitting now
    tar: Error is not recoverable: exiting now
    # mt -f /dev/nst0 tell
    At block 3.

The `second tars' all find read(2) returns 0 on their first call and
they exit with a status of 0.  Just as if `tar tf /dev/null' had been
done.

Can someone explain to me why I'm seeing the difference?

    $ dd --version
    dd (fileutils) 4.1
    $ tar --version
    tar (GNU tar) 1.13.25

Thanks,


Ralph.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]