Disk cloning basics using dd in Linux
January 6, 2012 4:45 PM Subscribe
Backing up a possibly-about-to-die hard drive and putting it on a new drive, using dd in Linux - a few questions regarding how the cloning works.
posted by Jimbob to Computers & Internet (10 answers total) 8 users marked this as a favorite
So the drive in my wife's PC (250gb SATA, Windows Vista) looks like it might be dying - making some weird noises. So I'm in the process of imaging it, and putting the image on a new drive. I am using the "dd" tool on a Linux live CD to do this. I just want to make sure I'm doing it right.
1) I copied the drive image to a file on a portable USB drive, using:
dd if=/dev/sda of=/media/PortableDrive/my.backup
It worked - no errors. It did take almost 3 days to copy the 250gb, though.
Now I have a new drive, plugged it in, and tried the reverse process:
dd if=/media/PortableDrive/my.backup of=/dev/sda
It dies within seconds, telling me there's an Input/Output error at 17mb into the disk. Does this mean that errors on the original hard drive were copied onto the image I made on the portable drive?
So, next thing I tried was plugging the old drive back in, and doing a direct copy from one to the other.
dd if=/dev/sdb of=/dev/sda
I got the same problem - IO error at 17mb into the disk.
Next thing I tried - direct copy using the dd_recover tool, which tries harder to read bad sectors. It didn't balk at the error at 17mb (although it noticed it), but the transfer rate was stupidly slow - about 3mb/s, so I gave up on that.
Alright, so now I'm using dd_recover to copy from the image on my portable drive to my new internal drive. It is going beautifully - much faster, no errors showing up. Can I assume that the bad sectors on my old internal drive will contain messed up data on my new drive? and, most of all, Am I doing this correctly at all?
It just seems strange to me that dd copied data from my old drive to my portable without an error (just slowly), but gave an error when I tried to copy from my portable to my new drive.