copying /dev/da0 with dd(1) to file: output differs
Warren Block
wblock at wonkity.com
Fri Nov 19 19:39:20 UTC 2010
On Fri, 19 Nov 2010, Matthias Apitz wrote:
> El d?a Friday, November 19, 2010 a las 07:16:53PM +0100, Hans Petter Selasky escribi?:
>
>>> I was thinking in a tool just reading each file block by block,
>>> comparing the blocks and noting the 1st diff with block offset number.
>>> (some 10 lines of C code :-))
>>>
>>> matthias
>>
>> Maybe you need to write a small C-program to do that.
>>
>> You can use bcmp() to compare two buffers.
>
> Will do that tomorrow.
>
> Just an idea: The USB key in question was new and I only created the
> file system on it the usual way (fdisk, bsdlabel, newfs). Then I
> restored the dump on it (which took 26 hours for 3.1 GByte dump file).
> The USB key boots fine, btw.
26 *hours*? USB 1.1?
> Could it be that unwritten/unformatted blocks are read as random data
> from that USB key?
Well, they could be anything. But the original filesystem has
formerly-used blocks with old data from deleted files. dump doesn't
copy those, but dd does.
> Should I overwrite the full USB key from /dev/zero?
Possibly there would still be differences. Filesystem metadata like
date last mounted, for example. If you want a block-by-block duplicate,
the brute-force method is to just dd the whole drive. Use bs=64k or
bs=1m to help reduce overhead.
More information about the freebsd-usb
mailing list