Sign in with
Sign up | Sign in
Your question

Cloning a disk with dd

Last response: in Linux/Free BSD
Share
August 31, 2010 5:12:13 AM

I am trying to clone a drive. My Linux system is Centos 4.8. Sda contains everything except home and opt. Sda has bearing problems on startup. It warms up and works fine, but obviously it is not trustworthy. So I got an exact model to replace it. I put sda in tray one and the new drive, unformatted in tray 2. I used knoppix 6.2 to boot the machine, dismounted both drives and then typed dd if=/dev/sda of=/dev/sdb bs=1M

Eventually I get an I/O error, but 113 gb copied. Fdisk indicates the disk is partioned and sized exactly like the original, but it will not boot with the new disk. What am I doing wrong?

More about : cloning disk

September 1, 2010 6:41:20 AM

Assuming your disk size is 113GB then I would suspect the copy went OK. (You don't actually say whether all the data appears to have copied.) A possible cause of the problem is that most modern distributions use the disk id rather than the device name for booting and mounting, so you may need to change this in /boot/menu/menu.lst /etc/fstab. (I don't think dd preserves the disk id.) I had exactly this problem last time I cloned a Linux disk.

The easiest thing to do is to use the knoppix boot again, mount the root partition on the copy and check these files. If there are references to a long string of numbers, rather then /dev/sda1, etc., in these files then change them to /dev/sda1 (or the appropriate partiton number) and try again.

Failing that, let us know the exact sequence of messages that you get when trying to boot from the drive.
m
0
l
September 12, 2010 4:02:48 PM

That sounds like excellent advice and I will try that-mike
m
0
l
!