Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 01 Dec 2007 14:19:59 -0600
From:      Kevin Kinsey <kdk@daleco.biz>
To:        stevefranks@ieee.org
Cc:        User Questions <freebsd-questions@freebsd.org>
Subject:   Re: using dd to duplicate disks/partitions of slightly different sizes	- works?
Message-ID:  <4751C1EF.4010206@daleco.biz>
In-Reply-To: <539c60b90712010929m7fef7020v806eb3c1eb24d066@mail.gmail.com>
References:  <539c60b90712010929m7fef7020v806eb3c1eb24d066@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Steve Franks wrote:
> I've got two 160GB disks.  Different manufacturers, so different #
> bytes.  One is FreeBSD, the other blank.  I'd like to backup my system
> for the fastest possible recovery after a crash - move the plug and
> power up.  I have gmirrored before, but I just wanted to do a quick
> dd, since I don't want to abuse my cheapo powersupply (has 4 disks
> already on it).
> 
> Two questions:
> 
> (1) If I dd from the smaller to the larger, will it work?  What
> happens to the extra, say 5MB of unused space - will my partition info
> be messed up?
> 
> (2) If I dd from the larger to the smaller (df reports only 50% used
> anyway) is there a way to make sure there is no info in the 5MB at the
> end that will overflow the smaller, and again, will my partitions be
> ok?
> 
> The other option is just to fdisk & label the other disk, then rsync
> everything to it.  Is that the wiser choice?
> 
> Thanks,
> Steve

Giorgos Keramidas made a great post dealing with this
a while back.  Here 'tis, quoted for your enjoyment
and potential enlightenment (also quoted is Martin
McCormack):

-----------------------------------------------
>>      It turns out that dd defaults to 512-byte blocks so I didn't
>> really need the bs=512, but I am not sure I haven't made some other
>> type of mistake.  The dd command has been running for about 4 hours on
>> a very fast system, with a 1-gig processor, 1 gig of RAM and two 31-GB
>> drives.  One would think it should have finished by now, but it is
>> still running.  Is this a valid method of copying the entire contents
>> of one drive to another?  Thank you.

Bah!  That's too slow for my taste.  I would usually go for a newfs,
dump, and restore option.  For instance, to create a copy of /usr on a
second disk:

    newfs -U /dev/ad1s1a
    mount /dev/ad1s1a /mnt
    dump -0 -a -L /usr | ( cd /mnt ; restore ruvf - )

Copying with dd(1) is not as fast  :)
------------------------------------------
HTH,

Kevin Kinsey
-- 
There is no royal road to geometry.
		-- Euclid



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4751C1EF.4010206>