UNIX Disk Cloning

Cloning a disk

dd if=/dev/sdb ibs=64K conv=sync,noerror | pv | dd of=/dev/sdd obs=64K


Input File (if) sdb is a block device (containing a single partition sdb1)Output File (of) sdd is a new, unformatted, unpartitioned driveInput/Output Block Size (ibs/obs) of 64K may be a reasonable choice if you are in a hurry.(the default of 512 will be slow, but does, theoretically, have less risk of corruption).(if you can afford a few extra minutes prep it is always better to calculate optimum block size values, see below).The command above could be done as a single dd command but putting in the pv (pipe viewer) displays a progress barConvert (conv) options: sync pads every input block with NULs to bs, noerror continues after read errors.(i.e. we want as close to an exact copy of our disk as we can get but without failing if the source has read errors)

At this point, you should have two identical disks. If you unmount one and mount the other then any applications (e.g. Plex) should not notice any difference.

dd stands for "data definition" although there a many commonly used, and probably more descriptive, misnomers. e.g... "disk destroyer", "delete data", "disk dump", "data dump"

Calculating Optimum Block Size Values

  • Always test more than once to be sure of your results.  
  • To reduce risk of corruption always prefer the smallest block size for similar performance.

Alternate methods

Bibliography