[Top][All Lists]

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

dd in loop doesn't transfer full blocks

From: jim
Subject: dd in loop doesn't transfer full blocks
Date: Wed, 08 Dec 2010 15:04:10 -0000
User-agent: G2/1.0

[reposted, with additions, from comp.unix shell, where the problem
wasn't solved]

Linux, kernel 2.6.27.x, bash-3.1, gnu coreutils 6.12

Pseudo shell code (much simplified from original):

decompress_file_to_stdout |\
   while $not_finished
      do  dd bs=$BS count=1
            #try to insert (new) label after every $BS bytes of
original data:
      done |  recompress_stdin_to_different_file

#end of pseudo shell code

The problem is that dd never transfers a full block; $BS is about
400000, and each time through
the loop, dd only transfers about 73xxx bytes, and sometimes less.
This suggests [??] that the finite size of the pipe buffer is somehow
involved (64k in Linux kernel
2.6.x), but this should normally not make any difference.  How can I
get dd to transfer a full block each time through the loop?  I have
RTFM about dd without being enlightened.

reply via email to

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