meaning of "count=" for dd?

Conor P. Cahill cpcahil at virtech.uucp
Wed Oct 25 07:19:32 AEST 1989


In article <419 at wjh12.harvard.edu>, gst at wjh12.harvard.edu (Gary S. Trujillo) writes:
> My empirical tests of dd leave me puzzled as to the real meaning of the
> "count=" argument.  The manual page says "copy only n input records."

What dd means by input counts is the number of reads performed in 
reading the input data.  For a file these numbers should always be the same,
but for a pipe this will probably not be true. The read() will get the 
current data in the pipeline and return a count that is smaller than the
block size.  dd will still count this as a full block.

The amount of data available in the pipeline will vary depending upon the
load of the system and the execution order of the two processes attached
to the pipeline.  The following dd runs illustrate the points above:

	cpcahil(virtech,428): ls -lRa | dd of=/dev/null obs=1024 ibs=8k
	0+202 records in
	246+1 records out

	cpcahil(virtech,429): ls -lRa > /tmp/ttt

	cpcahil(virtech,430): dd if=/tmp/ttt of=/dev/null obs=1024 ibs=8k
	30+1 records in
	246+1 records out

	cpcahil(virtech,431): ls -lRa | dd of=/dev/null obs=1024 ibs=8k
	0+205 records in
	246+1 records out

	cpcahil(virtech,432): dd if=/tmp/ttt of=/dev/null obs=1024 ibs=8k
	30+1 records in
	246+1 records out


Note that reading from a file will always return the same amount of "records",
but reading from a pipeline will not.


-- 
+-----------------------------------------------------------------------+
| Conor P. Cahill     uunet!virtech!cpcahil      	703-430-9247	!
| Virtual Technologies Inc.,    P. O. Box 876,   Sterling, VA 22170     |
+-----------------------------------------------------------------------+



More information about the Comp.unix.questions mailing list