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:

  1. Install the new hard disk in the laptop.
  2. Install the old hard disk in an external enclosure and connect to the computer.
  3. Boot the laptop with the Ubuntu live CD (10.10 in this case)
  4. Open a Terminal window
  5. Confirm the new empty drive is /dev/sda and the old drive is /dev/sdb. Confirm the recovery partition is /dev/sdb2.
  6. 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.
  7. Next type: partprobe to re-read the partition tables.
  8. 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.
  9. Reboot
  10. Run the recovery software as if you were using the original drive. (Pressing F11 on HP systems.)
  11. 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.

Comments

Haven't heard of that happening. Interesting result! I know there are ways to change the partition drive letters, but that's out of scope of this procedure.

Thanks Brad!

I typed a detailed comment yesterday about how this worked for me using some mods and variations for GPT - unfortunately it disappeared after I hit Save!! (maybe because I had opened the Comment link in a New tab?) Thought I had done a ^C to save the contents but a later ^V revealed an empty clipboard :(. I will try to retype the detailed steps soon when time permits.

Fow now, in a nutshell, I calculated the GPT partition table size using the link provided in a recent comment, I cloned this plus ALL non-Windows partitions (Unknown, EFI System, MS Reserved, and Recovery partitions) to the new drive, then used gdisk to build the backup GPT header and partition table. After this I could boot into Recovery on the new disk.

Cheers,
Peter (Oz)

Sorry to hear about the missing comment!

Worked like a charm accept the part with permission denied but solved with sudo -i command. Thanks!

Hi,

Not sure if this is still active, but I'll try anyway.

I have a Acer Aspire V5-171 with a failing harddrive (500 GB, cannot boot into Windows) and no back-up of the recovery partition. I bought a new 1 TB HDD, took the old drive out and replaced it with new drive, put the old drive in a USB enclosure and hooked it up to a free USB slot on the laptop, burned Lubuntu 16.10 to a USB stick, put the stick in another free USB port on the laptop and booted the laptop into Lubuntu. Opened disk utility to identify drives and partitions (new drive /dev/sda, old drive /dev/sdc and USB stick /dev/sdb.

Then I performed the step as per this tutorial (my comments/results added between ())

Boot the laptop with theLUbuntu live CD (10.10 in this case) - Lubuntu 16.10 in my case
Open a Terminal window
Confirm the new empty drive is /dev/sda and the old drive is /dev/sdb (/dev/sdc in my case). Confirm the recovery partition is /dev/sdb2 (/dev/sdc6 in my case).
Type: sudo dd if=/dev/sdc of=/dev/sda bs=512 count=1 to copy the exact partition table and MBR (Master Boot Record) to your new drive. (Terminal confirms MBR was successfully copied)
Next type: sudo partprobe to re-read the partition tables. (I didn't recieve any output from partprobe and when I refreshed disk utility it shows 1 TB of unallocated space with no partitions on the new drive sda)
Finally type: sudo dd if=/dev/sdc6 of=/dev/sda6 bs=1M (dd runs for about 2 minutes then returning an error that it cannot copy sdc6 because there is not enough free space on sda.

Can anyone tell me what I'm doing wrong and how to fix it so I can copy the recovery partition from my old drive to the new drive. I also tried using Ubuntu 16.10 and Ubuntu 12.05, but same result on all steps.

Thanks,

Michielo

I had similar problems to those described in the original post, I found this article to be the best fix. I have Windows 7 on an ASUS U36S laptop (no DVD drive, Windows 7 recovery partition). When I started I didn't even know what an enclosure was, but they are dirt cheap on eBay, I purchased an enclosure and a new HDD, and used the original post and all the suggestions listed in the following messages to restore my operating system on my new HDD. I can't thank you enough. I have another suggestion to add - after restoring my MBR (step 6), the new drive had the setup that existed on my old HDD - but the operating system partition was unformatted. When I copied the recovery partition over to my new drive (step 8) I ran my setup using F9 on reboot, the recovery would start as expected and would run for a few minutes but then just stop with no error message. It just stopped on a blue ASUS setup screen. I finally discovered that formatting the partition allowed the recovery installer to run as expected and install the operating system onto the partition. This was the missing step and final FIX for me! When Windows 7 and all drivers were installed, I ran Windows update and there were 200+ updates to install - took four hours and many restarts.

Pages