Serious dd breakage in current
oberman at es.net
Wed Jan 14 10:38:28 PST 2004
> From: John Baldwin <jhb at FreeBSD.org>
> Date: Tue, 13 Jan 2004 15:04:14 -0500
> On Monday 12 January 2004 07:19 pm, Dan Nelson wrote:
> > In the last episode (Jan 12), Kevin Oberman said:
> > > Today I bit the bullet and re-sized some partitions on my laptop's
> > > disk. One think I planned to do was copy the unchanged partitions from
> > > my backup disk to the primary with dd(1). This was a BAD idea and I
> > > suspect GEOM changes are at the root of it.
> > >
> > > I used fdisk to create new slices and then bsdlabel to make new
> > > partitions in ad0s2. Everything seemed to be fine.
> > >
> > > Then I ran dd to copy the root partition over: dd bs=32k if=/dev/ad2s3a
> > > of=/dev/ad0s2a For some reason it labeled the disk with the first
> > > partition starting at almost the end of the physical partition, over 30
> > > million blocks into the slice. bsdlabel generated a stream of errors
> > > including that every partition extended past the physical partition.
> > You can't dd disklabel partitions, as they use absolute offsets from
> > the start of the disk, not the start of the slice. The disklabel
> > command compensates for this so you see relative offsets. You can work
> > around the problem by dumping your partition info to a text file and
> > updating the new disk with disklabel after the dd command.
> dump / restore is a better method though anyways. It doesn't bother with
> copying unused blocks for one thing. It will also allow things like dirhash
> to more efficiently lay out your files on the new file system.
> John Baldwin <jhb at FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/
> "Power Users Use the Power to Serve" = http://www.FreeBSD.org
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 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.
Non the less, now that I see the problem with dd on a partition, I have
used dump and my system is now properly re-partitioned. It's nice to see
both /var and /usr under 98%!
Thanks again for taking the time to explain this.
R. Kevin Oberman, Network Engineer
Energy Sciences Network (ESnet)
Ernest O. Lawrence Berkeley National Laboratory (Berkeley Lab)
E-mail: oberman at es.net Phone: +1 510 486-8634
More information about the freebsd-current