Archive for February, 2011

Recovery of a Vista Laptop Hard Drive (using Linux).

Tuesday, February 15th, 2011

Some bad sectors cropped up on my wive’s laptop and her Vista Home Premium x86 would not boot. I, of course, am the resident tech support dude in the house, so it was up to me to restore Vista to a boot-able state.

I took a new drive allocated for the long overdue Windows 7 upgrade and copied a backup of the damaged Vista drive to it. At first, I tried to use SpinRite to scan and repair defects of the original Vista disk, however it took too long. So, I decided to use ddrescue to recover the data on the disk:


DDRLOG=/tmp/ddrescue-20110208.log
# see info ddrescue for more complete notes on its use.
# avoid the bad sectors on the first dump of data
ddrescue -n /dev/sda /dev/sdb $DDRLOG

# rescan the drive around the bad sectors and recover data (attempt 3 reads
# on bad sectors)
ddrescue -d -r3 /dev/sda /dev/sdb $DDRLOG

# save DDRLOG to some place.
ddrescue is part of the excellent “Ubuntu Rescue Remix” distribution. Boot into this Linux distro and then let the magic happen with the above ddrescue commands. For info about this distribution and other recovery tools please see this article.

Note: I had to rescue the disk in its entirety to have Windows Vista boot normally after the data recovery on the new drive. “ddrescue -n /dev/sda2 /dev/sdb2″ did not work for me. I am not sure why. A Vista setup DVD was able to detect /dev/sda2 and found a Vista OS installed on the partition. More over the Vista Setup DVD was able to repair the file system. And it attempted to perform Start Up Recoveries of the Vista partition. However in the end I was not able to make Vista boot properly using the single partition ddrescue copy. [I wasted three calendar days because of this mistake. Don’t repeat my mistake.]

Copying the disk and all its partitions in its entirety in one fell swoop did work for me. So I recommend the first set of ddrescue commands documented in this post when working with Vista.

Why was restoring Vista to a boot-able state so important before the Windows 7 upgrade? In order to install Windows 7 in an “upgrade” mode, Windows Vista must be boot-able and able to run the Windows 7 installer. (Thanks, Microsoft, for making the simple hard.) The Upgrade mode of the installer was preferred by my wife. The Upgrade mode retains all the installed Windows applications and other things added to Windows (such as fonts in my wife’s case).

After the original Vista Home Premium x86 was restored to a bootable state, I attempted an upgrade from Vista to Windows 7. (It was overdue anyway!) We had purchased a Windows 7 Ultimate 64-bit edition DVD, however this edition of Windows can not be applied to a Vista HP (32 bit) in Upgrade mode. Nice, Microsoft! Thanks again for making the simple hard!

So back to the store, I picked up a copy of Windows 7 Home Premium (32 bit). This version of Windows 7 allowed the original Vista Home Premium x86 edition to be upgraded.

After all this, Windows 7 happily boots on the laptop with the restored data. To date of this post, no lost data has been reported by my wife, so I assume the majority of the data on the Windows partition was preserved by ddrescue.

Thank you ddrescue for making the hard easy!