Subject: dd and pipe question
To: <>
From: Travis Hassloch x231 <travis@EvTech.com>
List: current-users
Date: 04/10/1996 15:16:57
Please respond directly to me via email.
I have a compressed tar image on disk, in file "foo.tar.gz".
I wish to write it out to a fixed block size tape (an 8mm, with
a 1k block size). My preliminary pass is:
gzip -dc foo.tar.gz | dd ibs=10240 obs=10240 conv=sync of=/dev/tape
However, (probably because of the pipe) there are _multiple_ partial
input blocks.
If I uncompress it to a file "foo.tar", this works fine:
dd if=foo.tar ibs=10240 obs=10240 conv=sync of=/dev/tape
But I'd rather not if I didn't have to.
Is there a proper way to set it up w/o using temp files?
I postulate that you might be able to set up some kind of "silo"
which read(2)s over and over until it gets a complete input block
or some kind of EOF/error. Then, it dumps complete blocks to
tape (or to another program? or does pipe size matter here).
*** DETAILED INFO - SKIP IF YOU AREN'T CURIOUS ***
In case you are wondering, I have to have distinct "ibs" and
"obs" rather than just "bs=10240" because on many OSes it sets
up only one buffer with "bs=10240", and will only write out
however many bytes were available on input at the time of the
read. I need the "sync" option so the last block is padded to
a multiple of a tape-hardware-block-size boundary (1k - in this case
10x1k). I chose 10240 because that's the default "tar" blocksize
(-b 20 == 20 x 512b) as well, and it seemed safer to have dd and
tar agree on the block sizes.
*** REFERENCES ***
For more info on what I've discovered about tapes, dd, tar, etc.,
check out:
http://www.cs.utexas.edu/users/vax/scsi_tape.html