Using dd to Make a Clone of a Drive

Erik Trulsson ertr1013 at student.uu.se
Thu Feb 9 12:50:38 PST 2006


On Thu, Feb 09, 2006 at 02:36:18PM -0600, Martin McCormick wrote:
> 	After installing FreeBSD5.4, the ISC dhcp server and ISC bind
> on a hard drive, I wanted to clone that drive to a second drive so as
> to generate a second server, using what I had already installed as a
> template.  I used the following command:
> 
> dd if=/dev/da0 of=/dev/da1 bs=512
> 
> 	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.

The reason it is taking so long is almost certainly because you are using
such a small blocksize.  

As it is 'dd' will read 512 bytes from da0, write those 512 bytes to da1,
read another 512 bytes from da0 (which will probably mean waiting a couple
of milliseconds for the head to get into the right position since the disk
will have rotated sinc the last read), etc.   The speed of your CPU, or the
amount of RAM you have, is quite irrelevant in this case.

If you try with bs=64k I can almost guarantee it will be a lot faster.


Otherwise it is a perfectly good way of making a copy of a disk, provided
both disks have the same size and geometry.


-- 
<Insert your favourite quote here.>
Erik Trulsson
ertr1013 at student.uu.se


More information about the freebsd-questions mailing list