Generally, dd
can be avoided in favor of some alternatives. There are several good reasons to use GNU ddrescue
instead. In Ubuntu, you can install it with:
sudo apt-get install gddrescue
and just plain ddrescue
to use. Note that differently from the package name, the executable does not have the initial g
.
Using it is as simple as:
ddrescue inputFile outputFile logFile
The log file (named whatever you choose) lets you pause/stop and restart, without redoing the previous work, which is useful when doing large clones or recovery of disks. By default, it displays progress, current copy speed, average copy speed and number of bad blocks found.
It uses sensible defaults for block size, so copy speed is always as fast as the device can handle, in my experience at least (I've cloned many hundreds of drives with it, all sizes and types).
Often times, drives that are starting to fail have speed issues such as occasional patches of slowness, low average speed, sudden long pauses (bad sectors) or complete resets (severe surface errors). ddrescue
can help you identify all the above and restart your clone (provided you specified a log file) even if your drive is resetting itself.
cp /dev/sda /dev/sdb
or (pv /dev/sda > /dev/sdb
to get a progress bar) would be a lot quicker. Why would you usedd
here?dd
would only be useful with things likeconv=sync,noerror
to handle disks with errors, but even then it would make more sense to use things likeddrescue
instead (see alsopv
's-E
option).cat
may be even quicker but the difference isn't that dramatic (maybe bigger for device-to-device than file-to-file as in my experiment).dd
pitfall #1