Thursday, March 3, 2011

Windows 7 Startup Repair - Not Quite Complete

Startup Repair is nice. Let me just get that out of the way first. I've used it many times to fix many problems, mostly related to the Boot Configuration Data, bootloader, etc. on both Windows Vista and Windows 7 systems. There seems to be, however, issues that Startup Repair can detect but cannot fix. The fixes for these problems aren't always inherently "impossible" from the standpoint of the environment in which Startup Repair runs. No doubt, there can and are many situations that prevent a Windows system from booting that startup repair cannot fix, nor can it be expected to fix. I encountered a situation today that I believe should be well within it's capability to repair.

System recovery options, including Startup Repair.

This morning I resumed a fix I had been working on yesterday for Jill's PC. I was working with a copy of her hard drive made by using Windows Home Server to restore the most recent backup copy of her hard disk from the day before. I had my reasons for doing it this way, in a nutshell they include: using a larger hard drive and not wanting to screw up her original. When restoring to a new hard drive you must prepare the drive and I happened to miss a step during this process. Essentially, when booting from the WHS client restore disc, you load a preinstallation environment of windows that starts the recovery wizard, installs lan drivers if needed, finds your home server and lets you pick which backed up PC and which backup of that pc to restore to which disk. You must, during this process, partition your new hard drive and set that partition as active. That last bit in bold is what I forgot to do. Failing to do that, the WHS restore application will not complain about there being something wrong with your restore destination and will happily spend the next four or five hours restoring 280GB of data over the network to this drive.

When attempting to boot the drive for the first time I encountered an error I didn't immediately expect. BOOTMGR IS MISSING. I fully expected, say, a Stop Error (I was replacing the motherboard at the time, the subject of another post). This message, again, was completely unexpected.

Unexpected.

I began to troubleshoot this issue out and part of that process was running the Startup Repair routine. Fortunately Startup Repair logs it's output and while it could be more thorough (I'd love to know not only the result, but the commands it runs - such is findable, I'm certain, but not right there). Among the root causes determined was a line that read "" Fantastic, I thought. Something's screwy with the partition. I decided to try to read the partition. For those of you who know me, you're aware that I love exploiting things like Notepad's open dialog when booting from purposefully restricted live installations of Windows in order to do all sorts of things (perhaps the subject of yet another post). Without going into the details (yet) I was able to browse around and found what appeared to be a relatively complete installation on a very visible and browseable volume on the hard drive. So what was wrong?

I decided I should have a look at the drive with the disk management utility and figured it wouldn't hurt to just use the same copy that I had used to create the partition, so I booted from the WHS Client Restore disc once again and went through the wizard until I was allowed to launch the disk management MMC snap-in. I discovered that I was able to right-click the volume and set it as active from there. This was what led to the eventual repair of the startup function. I restarted the machine, again got the "BOOTMGR is missing" error, which, by now was expected, but I was then able to use the Windows 7 Startup Repair (two passes) to successfully restore the bootsector and Boot Manager that was so desperately needed to get on with this repair.

Now, you're thinking "well, Startup Repair probably couldn't have repaired that problem, afterall, you had to use disk management, that's not available from where you were!"

Actually, it could have. And I could have, via the command prompt, available from the Windows 7 Recovery Options window using diskpart. What was accomplished with Disk Management would have also been doable with diskpart (I went through the motions, it's capable and available). Here's what it should do (and you can do, should you run into this yourself and don't want to do all the ridiculous booting back and forth between various other media):

Boot the system using the Windows Vista or Windows 7 install media, I don't believe this procedure even requires that you use media of a proper version or bittedness since you're just working on the hard disk here, but you'll need the right one to carry on with other startup repairs so make sure you have that.

Click "Repair My Computer" on the second page of the wizard that starts from this disc (after selecting language and keyboard layout).

Cancel any windows offering to restart the machine or telling you they cannot find a windows installation, you want to maneuver to the Advanced Recovery Options window (pictured at the top of this post).

Click Command Prompt at the bottom of the list.

Now you'll use diskpart to adjust your partition's attributes, type the following minus the parenthetical remarks and inserting appropriate values where I have indicated:

diskpart
list disk (you will see a list of fixed disk drives on your system)
select disk X (where X is the number of your hard disk, usually 0)
list partition (you will see all the partitions listed that the selected hard disk contains)
select partition Y (where Y is the number of the partition where Windows lives)
active
exit

Click the X at the top of the Recovery Options window and restart the PC, again, from the appropriate media and re-run Startup Repair. If you observe the logs different root causes and attempted repairs should be indicated. You may have to run through this last step multiple times (mine took two) but in the end you should be able to nudge Startup Repair through the required steps to make your system bootable again. And then, if you're like me, you can move on to the more pressing repair of the day...

No comments:

Post a Comment