On Tue, May 5, 2009 at 6:44 PM, Anders Johansson
On Wednesday 06 May 2009 00:33:48 Greg Freemyer wrote:
All,
I am a heavy user of dd and think I know it well, but we had some unexpected behavior out of dd recently. At least it was unexpected by us.
In its simplest reproducible form we did something like:
md5sum big_file
cat big_file | dd bs=32k conv=sync,noerror | md5sum [...] Anyway, I don't know if the above is by design, or if we have come across a bug. If a bug, is it in dd? the kernel?
You really don't want to use conv=sync here. noerror is fine, but sync is not. With noerror, dd will continue, and try its best to fill up the output buffer. With sync, it will bad the output buffer with zeros, which will do nasty things to your md5sum.
Anders
Anders, I understand what happened, but it really came as a surprise. And I'm not sure dd should consider a partial successful read as a failure that requires the data be padded out. dd does NOT consider it a big enough issue to actually stop the dd command if you leave off the noerror arg. ie. I normally dd with if=/dev/sdx. In that case conv=noerror,sync is critical. If you have unreliable media you are copying from and you leave off noerror, dd will stop after the first failed read. Those failed reads we obviously want padded out with zeros. This is different. dd is reading from a pipe and sometimes only a partial block is available. In the absence of conv=noerror,sync, it will process all the data coming from cat just fine, and the md5sum is accurate. Thus it seems to me, dd's definition of a read error is not consistent with my definition. Thus my uncertainty that it is a bug or just a really nasty feature. Greg -- Greg Freemyer Head of EDD Tape Extraction and Processing team Litigation Triage Solutions Specialist http://www.linkedin.com/in/gregfreemyer First 99 Days Litigation White Paper - http://www.norcrossgroup.com/forms/whitepapers/99%20Days%20whitepaper.pdf The Norcross Group The Intersection of Evidence & Technology http://www.norcrossgroup.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org