Monday, August 30, 2010

Restoring Windows 7 Image Backup to any partition

With my C: running out of space, I deleted the recovery partition on my hard disk. However, as the recovery partition occupied the space before C:, Windows was unable to expand C: to take the space. To move C:, I used GParted Live USB. However, GParted only created the partition, totally wrecking the data and Windows can no longer boot (WinRE cannot even recognize that I had Windows 7 installed). Luckily, I had heeded the advice to backup my computer before running GParted.

Recovering from the system image is not so straight forward. Firstly, the “repartition and format drive” is checked and cannot be unchecked. Thus, there is no way for me to restore Windows to a larger partition I wanted. Secondly, I had a Fedora partition which I suspect will be wiped out by the formatting. An alternative to overcome the restrictive options is needed.

After looking at these websites, Howto: Duplicate any Windows installation to a new hard disk using only a Vista DVD (!) and How to restore VHD file backup?, inspiration came to me. I could combine both instructions to recover my system image, which is a VHD, to any partition with no restrictions.

Firstly, I booted off the Windows 7 DVD and selected “Repair Windows”. Cancelling the wizard brings me to the advanced options. Selecting “Command Prompt”, I mounted the backup file (on E:) as F: by entering the following:

select vdisk file="E:\…\Backup Set…\Backup….vhd"
attach vdisk

Then, following the instructions on duplicating Windows installation, I typed

ROBOCOPY F:\ C:\ /e /efsraw /copyall /dcopy:t /r:0

It took an entire night for the copy to complete. Once done, I booted into the Windows 7 DVD and selected “Repair Windows” again. This time, the wizard detected a problem with the boot up and did the appropriate repairs.

I was overjoyed when I could boot into Windows again. However, Avast! antivirus prompted me for a new license key. Entering an old one made the dialog go away. Another program that I found broken was Microsoft Outlook, which responded with “Not Implemented” pop-ups when many of the ribbon buttons are clicked. Repairing Microsoft Office through Control Panel > Program Features solved the problem.