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

Many Thanks Brad

An excellent article. Saved my bacon! (Eventually)

Like you I had tried a disk clone, which failed as the main partition was faulty.
Being a Windows user I had to get my head around some of the Linux commands.

I ended up using Ubuntu 9.x on a workstationwith old and new drives connected via SATA.

The recovery partition was /dev/sdb3 on my old drive, once I had the drives connected in the right order.

I found the commands sudo fdisk –l /dev/sda and sudo fdisk –l /dev/sdb useful in identifying which drive was which. Made sure the new drive is “new” (not formatted) as that helped too.

So I created a new drive as per the above. Same size, and manufacturer. In the faulty computer F11 went into the recovery, and all seemed to go well, until right at the end, and after the actual recovery had completed, I got a small window “Windows setup could not configure Windows to run on this hardware”!!!

Arghhhh

So I went back again to your procedure, but this time used an older drive, same size, but a different manufacturer.

This time I got an error in Ubuntu, when it came to copy the recovery partition. Can’t remember it exactly but it was along the lines of “not enough space to copy”.

Finally I tried a clone using Acronis. I cloned the first drive I made. The one with the Windows setup error, to the second older drive from a different manufacturer.

Put this older one back in the faulty system, but received same Windows setup error when I booted of the system partioion.

So on this older drive I started a F11 recovery, and this time it worked. Must have been something the windows setup didn’t like on the new drive I used first.

Downloaded updates and configured etc. Then again using Acronis cloned this older drive onto the new drive that failed windows setup originally.

Finally got there !!!!

Thanks again, and Kind Regards
Andy (Wales UK)

Glad I could help! Hopefully your detailed description can help someone else too.

Great info,
I need to copy a functional recovery partition, I have just downloaded acronis but will try ur way first. Cheers.

Thanks a million Brad for posting this. You got me out of a complex harddrive switching nightmare. It worked for me just as you described in your post.

Great to hear. You are welcome!

Great tutorial! Thanks Brad! Im in the process of copping RECOVERY partition right now... it takes time as old drive have few Bad Sectors... Hopefully wont get any error :-)

Simon ( UK )

Thanks for the tips, they were very helpful. I tried to take a different approach at first but failed. First attempt, I kept the bad/old hard drive in the laptop, hook up a usb external drive and tried to copy the recovery console to the external by taking your directions and reversing some of the steps. This didn't work for all who will try.
I had to take the replacement/new laptop hard drive and take out the old/bad drive and hook them into my tower. I unhook all my other hard drives and just had the two laptop drives in the box, booted with Ubuntu and followed your instructions. The only thing I had to do was use the "sudo" command before each command because the old hard drive wouldn't give me permissions. Put the new hard drive back into the laptop and was able to boot from the recovery console. Thanks again.

Hi, I am a newbie at this so please bear with me.

I worked out how to get root access as permissions were denied but the second set of instructions about copying the recovery partition don't make sense to me. We only had one large partition which we copied the boot sector to (in my case dd if=/dev/sdb3 of=/dev/sda1 bs=512 count=1).
This gave me result of 1+0 records in 1+0 records out 512 bytes copied.

Do I still have the one large partition on my new drive (sda1)? I then typed
dd if=/dev/sdb1(my original recovery drive) of=/dev/sda2 bs=1M and the laptop froze. Is this because /dev/sda2 doesnt yet exist??? I am slightly confused.

Any help appreciated

Chris (UK)

Thank you! I was able to recover my neighbor's laptop. The main windows partition went bad, and I needed a way to get the recovery partition over to a new hard drive. This did it!

This info was instrumental in getting a client's HP recovered. I followed all directions changing them to match my disk identifiers. It didn't work at first it still asked for a missing winload.exe file. I booted back into Linux and set the recovery partition as the boot then it started recovery immediately.

Thanks again,
Jason FL USA

Hi Brad,

Just brilliant.

HP TouchSmart IQ522pt
Ubuntu Desktop 12.04 LTS i386
copy + paste instructions

It couldn't be more simple.

Thanks very much.

Cheers,

Duke

When my HD took a dump, I thought how clever I was when I pulled out the HP recovery CDs I had created a few years ago. Installed the new sata drive and loaded the first restore CD and restarted the recovery. Unfortunately when I loaded the second recovery CD, it would not read. After determining the recovery partition on the damaged HD was still functional, thats when I came upon your simple solution. I followed your instructions explicitly and after rebooting with Ubuntu Live 12.04 and determining the first attempt left my new HD with a partial restore partition, I simply deleted the corrupted partion on the new drive with the Ubuntu disk utility. The only problem I encountered was the permissions issue when copying. Not being familiar with Ubuntu, it took a little time to figure out the Sudo and running as root. After that it worked perfect!!! Since the new drive was twice as big as the original, the recovery partition was in the middle of the drive. I simply created an addition partition with the remaining available space. The bonus by restoring this way I was able to create new recovery CDs (maybe next time they will work?)

Thanks again Brad for such an elegant solution.

aj

Thank you very much for this page. I had a damaged hard drive and no recovery CDs, so I was able to use this process to copy the recovery partition to the new, empty hard drive. Just a couple of things from my experience that might help others.

1. I couldn't figure out how to confirm which drive was which, so I had to go to Google. I found a program in Ubuntu called "gparted" that let me see the partitions graphically. It was already installed by default. I just typed "sudo gparted" to run it. It showed me all the drives (including the USB) and where they were located. My new drive was /dev/sba and the old drive was /dev/sdb and the recovery partition was /dev/sdb1

2. I was using Ubuntu 12.04 LTS (LiveCD) and at first I couldn't get permission because I was using the "ubuntu@ubuntu" terminal login (the default). I had to google how to get root access by typing "sudo -s".

2. Once I had root access and I copied the partition table and MBR over, I typed "partprobe" and got a partition table error on the new drive. To fix it, I had to run fdisk on the new drive. I typed "fdisk /dev/sda" (without "sudo" because I was in a root terminal). Then I typed "p" to print out the partitions table, and then "w" to write the partition table back to the new drive.

3. Once that was done, I could copy the recovery partition to the new drive and then recover the laptop.

This is exactly what I need to complete the recovery partition transfer!

I'm having a bear of a time with this. I just got an ssd to breathe some new life into an aging laptop but found out the hard way I can't put recovery discs in a computer without the old recovery partition. I don't have an external enclosure to copy A to B but logically A to B to C should work if they're all formatted and partitioned the same, right? Well it's still not working for me. Now I'm debating a pirated version of windows or linux even tho I paid for the win 7 upgrade already :(

Ubuntu worked great. I used ver. 12 or something like that. This procedure did not work for me but I copieds the entire drive for my HP nc4400 and it worked like a charm! Could not get it to work on a SSD smaller than my original HDD, But once I tried it on a 90GB SSD, it worked great by using:

sudo dd if=/dev/sdb of=/dev/sda bs=1MB

This copied the entire old drive onto my new SSD on a desktop machine and then I used F11 to restore. Victory!

Just recovered a friends HP laptop using your method, many thanks.
I used sudo commands to gain permissions.
First time I tried it, the laptop said there was no bootable disc and to try again. Fiddled with a few things to no avail so wiped the new drive using Gparted and tried again ( The new drive was showing 4 partitions all a bit weird with errors )
After wiping and trying for the 2nd time, all worked exactly as stated.
Thanks for sharing!

Thanks for the great write up! It helped me alot, but I will have to say that in my case this exact method did not work. I was fixing a Dell desktop and the 80GB harddrive crashed. I bought a new harddrive, which is 500GB. After using this method, rebooting to new drive, hitting CTRL-F11 at boot, the system came back with "cannot restore".

But this article and the comments and some insight, I fixed it! And here is how:

1) I took insight from #1 comment, Andy. Make sure the drive is unformatted. I'm using a Linux Mint 13 Xfce Live CD, in there is a "Disk Utility" program (which doesnt seem to be in the KDE flavor). In this utility you can easily see your drives and their partitions. I selected the new 500GB drive, and clicked the Format Drive button. In the dialog box which opens, I selected "No Partitions". Which makes it as blank as possible, I suppose.

2) In terminal, I ran "sudo fdisk -l". To see a full list of disks and partitions and made note of my source (/dev/sda) and destination (/dev/sdb) paths.

3) I followed #13 comment, MDVillars. I ran "sudo dd if=/dev/sda of=/dev/sdb bs=1M". Which seemed to copy the entire drive, partition tables and boot records. The second partition (the main C drive in Windows), was corrupted, so it died during that part.

4) Knowing that the third partition is the restore partition (and the fact it didnt get a chance to copy from the above command). I then ran "sudo dd if=/dev/sda3 of=/dev/sdb3".

5) Shutdown, unplug old drive, turn on. Hit CTRL-F11 at boot, and presto! I was booted to the restore partition on the new 500GB! Windows installation was successful!

Note: After step 3 above, if you run "fisk -l" again, it marked each partition with some weird warning about it not be in line with the physical sector or something. I ignored this and continued on.

Note: During step 4 above, it gave some error that the device ran out of space. I ignored this and continued on.

Note: I tried all sorts of ways and failed. Until, I did step 1 first. I'm not sure what the command line version of this would be. I had to use Linux Mint 13 Xfce. But I would guess that the "Disk Utility" program is available thru the software manager in any Ubuntu flavor (or heck, any Linux distro with a software manager).

Note: After this, there is 400+ GB of unallocated space at the end of the drive. And since restore partition is the 3rd partition, I assume I cant resize the main partition. So I allocated it as a secondary drive.

I hope this helps others!

Pimp

I would like to add my thanks to all those that provided their help and insights. I had an HP from a friend in the same predicament. No Restore Disks. In my case, the absolutely critical tip here that made my recovery a success was running fdisk on a windows machine on the system partition of my damaged drive. I had been able to copy the partions I needed using the above instructions but the system partition had been corrupted so it still didn't work. After running Fdisk a few times, I was able to recopy to the new drive and then I was able to access the recovery partition. Well done everyone!!!

I understand this is not a discussion forum but if you can help me I would be grateful. I messed up my HP recovery partition but before that I backed it up using EaseUs Todo Backup on another drive. Now I can restore it, but it wont fix the MBR and it wont boot using F11. I made the partition active and recovery manager started but it doesnt show any option to restore to factory OS. All options remain disabled with exception to command prompt

It seems that almost everyone who has posted here is very satisfied with the outcome achieved by the instructions.

I was wondering if any monitors or future visitors to this thread could advise if the procedure has been successful in the transfer of the recovery partition to a second drive when a Toshiba laptop has been the test Case?

I am terrified of breaking something that doesn't need fixing however I have a couple of questions if someone would be so kind:

1) I would like to know if instead of MOVING in tact partitions to a new drive (if that is indeed the case here), whether they could be COPIED to another drive as a complete "out of the box" backup in the case of total hard drive failure (and while doing so causing no damage to the original drive)?

2) I am semi literate with Linux and believe I could clearly identify partitions. I would be quite comfortable having a crack at the above procedure but would require commands for the COPY process (once again if that is NOT what is already happening as per the instructional) if they could be provided by a knowledgable user. Can anyone possibly assist?

Apologies for my "newbness" but any assistance is appreciated.

This procedure only copies. It does not modify the source drive.

Hey, I have a HP Pavillion 15-B001tu notebook. I happened to format the complete hard disk. But, I have the recovery partition exactly imaged to an external hard disk using ubuntu live cd. Can I restore my PC. If yes, Please Suggest.

Yes, you can clone/copy the partition back to your drive. Recreate the partition table as it was originally, then clone the recovery partition back to the drive. You should be able to get it to work, but it may be complicated.

i have tried you step using ubuntu 12.4.2 LTS and it worked but the following is to be noted:

1- the first command in ubuntu terminal should be typing "sudo -i" (to gain admin authority, when asked for password just hit enter as there is none.
2- "partprobe" command won't work in Ubuntu 12.4.2 LTS live CD (i don't know the reason) but this does not affect the process, you can proceed to the next step with no issues

the laptop i used was toshiba and the recovery drive was sdb1 not sdb2

The exact drive partitions will change depending on manufacturer.

Sheree - just to settle your fears, the dd tool does not MOVE a partition, it copies. The exact procedures will vary depending on the individual drive setup i.e. partition 3 on the primary drive would be /dev/sda3 To copy the entire filesystem, including mbr do not specify a partition number, just use the drive device name, i.e. /dev/sda.

There's lots of detailed instructions on the use of dd if you need more info.

The initial instructions worked for the most part. When I tried to run the #partprobe command I received the below error.

[root @ubuntu]# partprobe
Warning: Unable to open /dev/sr0 read-write (Read-only file system). /dev/sr0 has been opened read-only.
Warning: Unable to open /dev/sr0 read-write (Read-only file system). /dev/sr0 has been opened read-only.

Since partprobe (based on what I saw) is used to re-read the partition tables without restarting Ubuntu. I restarted Ubuntu 11.0 (live cd) and continue to step#8. The laptop appear to be doing nothing and when I came back the screen was black but there was no activity on my external drive (old drive). I fired up the system again and voila!!! I am on my way to recovering factory installation. Thanks a million Brad. I have been looking for this solution for the past few system repairs I had.

I made a disk image of the recovery partition using ntfsclone and thought that it would suffice but reading this explains why F11 doesn't work and the depressing black screen I get when I set it to boot from the recovery partition.
Is there any way to fix it without a backup of the original MBR?

The MBR depends on your specific computer and the manufacturer. Sometimes a simple ntfslcone would work, but I'm sure many MBRs are customized so they won't work if copied elsewhere.

I's to bad they have to overcomplicate things.
Vista is no good anyway so I went with Ubuntu.

Just for the record,
dd_rescue and/or ddrescue are tools to be taken into account to read a partition with surface errors.
http://www.forensicswiki.org/wiki/Ddrescue
Regards

Hello,
Thank you so much for your help.
I did what you said, but my problem was my new HDD, is 750GB and my old one was 500GB.
So I change the commands:
type "dd if=/dev/sdb of=/dev/tempsdb.bak bs=512 count=1"
then type "dd if=/dev/tempsdb.bak of=/dev/sda bs=446 count=1"
then I ran GParted, and Copy partitions from old hdd to new hdd.
and everything be fine now

Regards

I try to copy the old 320 GB drive from my probook 4730s to a new 750GB drive to have a working recovery partition. So far I failed. I tried the first method first copying one MBR sector and then the recovery partition. I noticed the old disc in my case /dev/sdc has 4 partitions: sdc1 SYSTEM 300 MB, sdc2 noname 275 GB, sdc3 HP_RECOVERY 18 GB and sdc 5 GB HP_TOOLS. Perhaps the SYSTEM part of 300 MB needs to be copied too? Will try to copy the entire disk on a next occasion.

After copying the entire contents of my 320 GB to a new 750 GB disk I could start of the recovery partition and finish the installation. Since the new disk is a 750 GB disk I now have a unallocated space of 400 GB. Is it possible to move the hp recovery and hp tools partition to the end of the 750 GB disk and add the remaining unallocated space to the Windows partition?

You may be able to, but you'll have to test it. You should be able to resize the main partition correctly, but I cannot say if the tools will continue to work.

Somehow I am not able to resize the main partition. Moving HP Recovery and HP Tools partition the the "end" of the disk results in a black screen with an errot that due to a recent hardware or software.....

error 0xc0000255.

As soon as I touch the HP RECOVERY partition the recovery isn't working. I might format the unallocated space and assigng its own drive letter.

If the system is going to fight you that much, you could leave the existing partitions alone and partition the remaining drive space into a new drive D:. It's not optimal, but it'll work.

Hi,

I'm upgrading to a SSD hard drive which is 120 Gb, while the original drive is 512... will this procedure work? The partition table won't be the same! I just need to copy the recovery partition and make it work, and then reinstall from scratch... any help?

Thanks

This process replaces your drives partition table with the one from your old drive. Computer manufacturers often customize the partition tables on computers with restore partitions. The restore system will often not bott without this custom partition table.

TLDR: Generally, yes.

Very good post but unfortunately didn't work for me. I have an HP Pavilion g4 and somehow managed to get contents of partition table on the USB HDD. What i did was, just ran the first command "dd if=/dev/sdb of=/dev/sda bs=512 count=1" which created partitions on the new drive. Installed Windows 7 Home Premium (Legitimate ISO Image) and of course skipped the Windows key. Once windows is installed, restarted and pressed F11 for recovery. Bingo!!!! I have my hp customized windows again up and running.

Add new comment