Subject: Re: dd and pipe question
To: None <current-users@NetBSD.ORG>
From: Christoph Badura <bad@flatlin.ka.sub.org>
List: current-users
Date: 04/14/1996 02:00:00
Travis Hassloch writes:
>gzip -dc foo.tar.gz | dd ibs=10240 obs=10240 conv=sync of=/dev/tape

You do NOT want conv=sync.  It pads every *input* record to ibs.  So
for every short read on the input, you get pad bytes added to make up
for ibs.

According to Chris Torek[1] dd behaves as follows:

  dd if=x of=y

is the same as:

  dd if=x of=y ibs=512 obs=512

which means: open files x and y, then loop doing read(fd_x) with a
byte count of 512, take whatever you got, copy it into an output
buffer for file y, and each time that buffer reaches 512 bytes, do a
single write(fd_y) with 512 bytes.

On the other hand:

  dd if=x of=y bs=512

means something completely different: open files x and y, then loop
doing read(fd_x) with a byte count of 512, take what you got, and do a
single write(fd_y) with that count.

</Torek>

So you want something like:

gzip -dc foo.tar.gz | dd obs=/dev/tape ibs=10k obs=10k


[1] The qoute is from an article posted to comp.unix.question on
4/3/1991 which I would have sworn I have saved somewhere but can only
find it as article 20.16 in "UNIX Power Tools".
-- 
Christoph Badura	bad@flatlin.ka.sub.org

You don't need to quote my .signature.  Everyone has seen it by now.
Besides, it doesn't add anything to the current thread.