Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Feb 2002 06:42:27 +0200 (EET)
From:      Giorgos Keramidas <keramida@freebsd.org>
To:        jacks@sage-american.com
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Using dd to clone HD
Message-ID:  <20020210063555.U16121-100000@hades>
In-Reply-To: <3.0.5.32.20020209110118.0195ca18@mail.sage-american.com>

next in thread | previous in thread | raw e-mail | index | archive | help
jacks@sage-american.com wrote:

> On a FBSD box (4.5-stable) with two identical HDs and in the abscence of a
> good IDE HD mirror solution in pursuit of making an exact clone of HD0 to
> HD1, I thought I would give "dd" a try. I've seen several postings about
> the syntax to use and I'm not completely clear about the "bs=0000"
> parameter to use, if one is used at all. I seen:
>
> dd bs=4096k if=/dev/ad0 of=/dev/ad1
> or...
> dd if=/dev/ad0 of=/dev/ad1 bs=8192
>
> or... that the bs should be set to 2048 for "faster" copy.
>
> Questions:
> 1) Will the above make an exact clone of identical HD0 to HD1..??

Yes.  All of the above will create an identical copy of disk ad0 to ad1,
copying disk sectors one by one.

> 2) Should the the "bs" be used..??

Changing the bs= parameter makes dd(1) use different 'block size', or
'buffer' if you prefer this term.  Larger buffers will probably give you
better throughput and copy the entire disk a bit faster.

> 3) If "bs" should be use, how do I determine which one: 2048, 4096, 8192...??

This I can not answer.  Perhaps some more knowledgable hackers will fill my
gaps here.

> 4) should bs be used as in #1 or #2 or both okay..??
>
> I suspect this can screw up the HD if not careful.... so any expert tips
> appreciated.

Well, yes and no.  Copying from the wrong disk TO the wrong disk will
certainly get you in trouble.  Other than that dd(1) can do what you want.

I would try to avoid dd though, since it can cause problems if the disks
are not identical.  Think about copying the data of a 10 Gb disk to the
empty area of a 20 Gb disk.  Since dd(1) knows nothing about disk
geometries and such funky stuff, it will promptly overwrite the MBR of the
destination disk with the geometry information of the source disk :(

You'll probably find it easier to backup/restore with dump(8) and
restore(8), or even use pax/cpio/tar to copy the data to the destination
disk after partitioning, labelling and formatting it properly.


Giorgos Keramidas                           FreeBSD Documentation Project
keramida@{freebsd.org,ceid.upatras.gr}      http://www.FreeBSD.org/docproj/


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020210063555.U16121-100000>