Using dd to Make a Clone of a Drive

Jack Stone antennex at
Wed Feb 15 06:48:42 PST 2006

I have used dump/restore and dd as well. For a block size, I chose 102400 
which was the fastest -- but still slow compared to dump/restore. 
Dump/restore is not limited to making a whole image, blanks and all like dd.

Once upon a time, I used this as the best:
dd if=/dev/ad0 of=/dev/ad1 bs=102400

The obvious intention is to minimize the number of transfers, so 
theoretically the larger the transfer, the better. The maximum I/O transfer 
size is limited to the value of MAXPHYS, which is defined in

  #ifndef MAXPHYS
  #define MAXPHYS		(128 * 1024)	/* max raw I/O transfer size */

The ATA subsystem uses this value. SCSI drives were limited to 60 kB 
transfers, though this could have changed.  I don't currently have any 
machine with SCSI disks connected, so I can't confirm that.  A way to find 
is to run a command like will show the I/O:
#dd if=/dev/ad0c of=/dev/null bs=128k &

and in the background do an 'iostat ad0 1'.  Here's an example with an
IDE drive:

#iostat ad0 1
        tty             ad0             cpu
   tin tout  KB/t tps  MB/s  us ni sy in id
     0    3  5.19   7  0.03  11  0  4  1 84
     0  126 127.36 183 22.74   0  0  6  2 92
     0   44 128.00 190 23.76   0  0  2  0 98
     0   44 128.00 191 23.89   0  0  5  0 95
     0   44 128.00 191 23.88   0  0  7  1 92

As you can see, it's really doing 128 kB transfers, for an average transfer 
rate of almost 24 MB/s.

I do all of my backups every night by scripts by using dump/restore to a 
dedicated separate HD. It is bootable and ready to go in case of a problem 
with my master HD. Just shutdown, switch HDs and reboot -- voila! Back on 
line within a minute and the data is always only a few hours old at the 

Once you master dump/restore, it is indispensable for handling file systems.

Best regards,

FREE pop-up blocking with the new MSN Toolbar – get it now!

More information about the freebsd-questions mailing list