Copy a functional recovery partition to a new hard disk
My sister owns a HP laptop. Recently, while powered up, she knocked it off an ottoman. This caused a head crash and intermittent clicking noises indicating a broken hard disk. When powered, the drive responded, but would no longer boot into Windows. I put the drive in an external enclosure and was able to quickly backup all of her data. The majority of the data was luckily intact and accessible.
I ordered a new hard disk, and asked her for the recovery discs. Of course, she'd never made them. When the new drive arrived, rather than installing a different OS, I wanted to simply run the recovery software I knew was on her old drive. First, I tried cloning the recovery partition to the new drive and making it bootable/active. The bad sectors were all in the main drive, so the data copy was successful. Booting the partition resulted in a useless black screen. After some additional testing, I worked out a method using an Ubuntu live CD.
This method was created on a HP laptop, but can be adjusted for many other systems:
- Install the new hard disk in the laptop.
- Install the old hard disk in an external enclosure and connect to the computer.
- Boot the laptop with the Ubuntu live CD (10.10 in this case)
- Open a Terminal window
- Confirm the new empty drive is /dev/sda and the old drive is /dev/sdb. Confirm the recovery partition is /dev/sdb2.
- Type: dd if=/dev/sdb of=/dev/sda bs=512 count=1 to copy the exact partition table and MBR (Master Boot Record) to your new drive.
- Next type: partprobe to re-read the partition tables.
- Finally type: dd if=/dev/sdb2 of=/dev/sda2 bs=1M to copy the entire second partition containing the recovery software to the newly created partition.
- Run the recovery software as if you were using the original drive. (Pressing F11 on HP systems.)
- Once the recovery is completed, resize the partition to full size of the drive. (For re-size details see Google.)
This method works because the dd software copies the data exact drive data, while accessing the minimum amount of the drive. We skip the areas of the drive we know are bad. If we created a partition table ourselves, we can't guarantee that the HP system BIOS would recognize how to run the recovery software. Since the important pieces of data are exactly the same, the recovery software can run correctly.