Serious dd breakage in current
bde at zeta.org.au
Wed Jan 14 11:40:20 PST 2004
On Wed, 14 Jan 2004, Kevin Oberman wrote:
> Thanks to both John and Dan. I clearly did not correctly understand how
> dd operated. Guess it's time to read the sources a bit.
I have no problems using dd to copy partitions, at least in versions of
FreeBSD without GEOM. If the target contains metadata (e.g., disk label(s)),
then it may need to be skipped using something like:
dd if =/dev/ad0s1a of=/dev/ad1s1a count=1 # copy up to label
# Adjust target metadata later (or before) if necessary
dd if =/dev/ad0s1a of=/dev/ad1s1a iseek=2 oseek=2 # copy a bit after label
dd if =/dev/ad0s1a of=/dev/ad1s1a bs=64k iseek=1 oseek=1 # copy rest
If the source contains metadata (e.g., disk label(s)), then the metadata
might not be copied correctly or might spring to life on the target
inconveniently as soon as it is copied. If so, it can be skipped or
adjusted as necessary.
Versions of FreeBSD without GEOM have weaker restrictions on clobbering
metadata. Reads and writes to who disk devices are always permitted
and no translation of metadata is done. So any disk region can be copied
dd if =/dev/ad0 of=/dev/ad1 iseek=whatever1 oseek=whatever2 count=whatever3
This is rather dangerous, so I rarely use it except with a count of 1
to zap metadata blocks after carefully checking that the seek offsets
are correct. A safer version of this is to put the seek offsets and
count in slice or partition entries and then copy between the slices
or partitions. FreeBSD partitions have strong enough restrictions on
overlapping and on clobbering of active (mounted) partitions to prevent
clobbering via simple most mistakes like typos in the the offsets (not
to mention the drive number).
> I understand why dump|restore is a better choice than dd in may ways,
> but, if a partition is large and full, dd is MUCH faster. That's why I
> use it to backup my system disk. I can copy 40 GB in about 40 minutes on
> my laptop and dumping takes just a bit longer.
I normally use tar, since dump just doesn't work for non-ffs partitions.
Is dump really only a bit slower than dd? dd is 10-20 times faster than
tar for me, since I have lots of small files in src and cvs trees and
these trees were very fragmented until I rebuilt them recently (tar can
be no faster than ffs itself).
More information about the freebsd-current