Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!uakari.primate.wisc.edu!ginosko!cs.utexas.edu!uunet!virtech!cpcahil From: cpcahil@virtech.uucp (Conor P. Cahill) Newsgroups: comp.unix.questions Subject: Re: meaning of "count=" for dd? Message-ID: <1989Oct24.211932.334@virtech.uucp> Date: 24 Oct 89 21:19:32 GMT References: <419@wjh12.harvard.edu> Organization: Virtual Technologies Inc. Lines: 42 In article <419@wjh12.harvard.edu>, gst@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 | +-----------------------------------------------------------------------+