[olug] using dd to clone a drive

Christopher Cashell topher-olug at zyp.org
Wed Apr 20 11:24:38 CDT 2016


On Tue, Apr 19, 2016 at 10:16 AM, Justin Reiners <justin at hotlinesinc.com>
 wrote:

> ddrescue is great, I use it all the time. Hih
> On Apr 19, 2016 9:50 AM, "Matthew G. Marsh" <olug4mgm at paktronix.com>
> wrote:
> > +1 on that. I actually install this as dd on my systems as the syntax for
> > basic work is pretty much the same and the extra error correcting
> features
> > are well worth it. Especially when you use it over a netblock connection.
> >
> > mgm
> >
> > On Mon, 18 Apr 2016, Dan Linder wrote:
> > If you're looking to save the data that might be in the bad sectors, use
> >> "ddrescue".  It's restart-able and has options to intensely try the
> failed
> >> sectors.
> >>
> >> Dan
>

To follow on the comments from Dan and others, dd will usually work, and
has the advantage of being installed on almost every box.  However, there
are better tools that are worth looking at if available.

There are at least half a dozen dd-like tools[1] that handle disk errors
and bad sectors better than dd.  Many of them perform better, too,
defaulting to larger block sizes.  The better versions will start with a
large block size, and then reduce it repeatedly if they run into problems,
minimizing lost data, and maximizing recovered data.  Most of them give
better visibility into status, too.

Another thing that can be handy is to use dd to copy the disk to a disk
image file.  That image file can then be mounted via loopback for accessing
the data.  This can be easier to work with and manage than trying to go
straight from one drive to another drive.

One potential issue with traditional dd is that if it runs into a block it
can't read, it can get hung on certain disk errors trying to read data.
Many of the dd replacements will set a timeout after which they'll reduce
the block size and retry, or eventually give up and move on.

For a 1GB drive, if any copy hasn't finished in a couple of hours, it's
unlikely it will finish.  Try a different dd replacement that handles
errors better and see if that works for you.

Note, also, that dd can be used on a full disk (i.e. /dev/sda) or on a
partition (i.e. /dev/sda1).  Depending on what your goal is, one or the
other might be more appropriate.

 [1] Quick list of packages from a Debian box: dcfldd sdd ddpt dc3dd rdd
myrescue gddrescue safecopy

-- 
Christopher


More information about the OLUG mailing list