Re: dd to clone a drive
- Date: Tue, 26 Sep 2017 10:14:57 -0400
- From: Roberto C. Sánchez <roberto@xxxxxxxxxx>
- Subject: Re: dd to clone a drive
On Tue, Sep 26, 2017 at 09:57:57AM -0400, Jack Dangler wrote:
> I have an existing drive near EOL (judging from the sounds). I got a
> replacement drive for it (same size).
> I plugged the replacement into a USB port and started a byte-for-byte copy
> dd if=/dev/sda of=/dev/sdc
> The process ran quietly for almost 30 hours with no discernable results so i
> killed it. Apparently, it had been running the whole time and resulted in
> approximately 300 of 500Gb copied. Is it 'usual' to have dd take upwards of
> 2 days to copy a drive ?
> The source drive is a 500G 5400rpm WD, and the target is a 500G 7200rpm WD
That all depends on many factors. If your machine has poor I/O
performance to/from USB (which may be the case depending on whether it
is a USB 1.1, 2, or 3 port you chose and the chipset in the USB
enclosure) you might see transfer as low as 20 MB/sec. If you do some
(20 MB/sec) x (1 GB/1024 MB) x (3600 sec/hr) = ~70 GB/hr
If your machine is experiencing other loads, that may further reduce
performance and if the chipset in the USB enclosure or the USB
controller on the motherboard happens be buggy then it could be worse.
In your case with a failing drive in the mix, I suspect that the
controller is bogged down at least partially with attempting to do error
correction. My experience with transferring an image of a failing drive
a few weeks ago was that it took far longer than I expected for a drive
of its size and performance characteristics.
There is an example given in the dd(1) man page for how to monitor the
progress of a dd operation:
Sending a USR1 signal to a running 'dd' process makes it print
I/O statistics to standard error and then resume copying.
$ dd if=/dev/zero of=/dev/null& pid=$!
$ kill -USR1 $pid; sleep 1; kill $pid
18335302+0 records in 18335302+0 records out 9387674624
bytes (9.4 GB) copied, 34.6279 seconds, 271 MB/s
I like to use watch to give me periodic updates on the command. You
could do something similar like this:
dd if=/dev/sda of=/dev/sdc& pid=$!
watch -n 60 kill -USR1 $pid
That will give you a running progress of the command at 60 second
intervals. That would like you know if the process is uniformly slow or
if it is varying and you could fairly easily estimate the remaining
Roberto C. Sánchez