Clone Failing Hard Drive?

Nicholas Leippe nick at leippe.com
Thu Nov 8 10:27:43 MST 2007


Here's one way:

1) get the new drive installed, and boot from a rescue/live cd such as
   dam small linux or gentoo install cd, etc.

2) copy the boot record (including partition table) to the new drive:

   dd if=<old drive> of=<new drive> bs=512 count=1

3) resize the partitions on the new drive as desired:

   fdisk <new drive>

4) use dd (or dd_rescue if necessary) to copy the old drive, partition
   by partition to their new location on the new drive.

5) if you enlarged the partitions on the new drive, you can enlarged
   the filesystems using their respective tools.

6) if you moved the boot partition, you may need to reinstall your
   bootloader, if you left your boot partition the same, (at least for
   grub) you shouldn't have to do anything

7) mount the filesystems from their new location and test it

8) power down, move the new drive to be the boot drive, remove the old
   drive, and you should be good to go.


Another way would be to simply do steps 1-3, then create new filesystems on 
the new drive, and use tar to move the data from one drive to the other. This 
could potentially be faster. (Especially if you use the dd double-buffer 
trick to speed it up.)



More information about the PLUG mailing list