Updated: March 26, 2011
Windows can go kaput. Fact. Happens to the best and worst of us. The only thing that separates a monkey from a code monkey is one's ability to quickly and painlessly recover from a disaster. In this regard, we're talking both system and data. So you have your pictures and porn backed up to an external media. Good for you. But would you not like your machine to be able to boot once more, without going through a long and tedious task of installing and configuring it all over again.
In today's piece, we will discuss Windows recovery tools, both those provided by Microsoft and third-party companies, live CD tools, even Linux. All of these can be used to rescue Windows from malfunction. There are many tools and options available. We shall check them all!
Windows XP
Windows XP does not have a very remarkable built-in recovery mechanism. However, with the installation CD, you can still do a handful of useful things. Better yet, if you're using a live bootable Windows CD, then you can do a whole lot more.
Fix broken MBR
This is one of the most common tasks, especially if you hazard into the world of dual-booting your Windows XP and Linux. Not to worry, boot from Windows installation disk and do the magic, as explained in Microsoft instructions:
fixmbr
So far, so good. However, like I mentioned earlier, you may want to try BartPE or even the more powerful Ultimate Boot CD For Windows (UBCD4Win). This is the Swiss Army Knife of the Windows world, the Windows equivalent to a fully fledged Linux live CD, with tons of great programs and tools that can make your live healthier.
Windows 7
Windows 7 has more robust recovery options. The top-end versions of Windows 7 actually create their own 100MB recovery partition, which stores the critical system data. Sort of like OEM-provided hidden restore functionality on laptops.
I've shown you an example of Windows 7 recovery in live action in my second dual-boot tutorial, with Windows becoming unbootable after Ubuntu was installed. We sorted it out fairly easily. In fact, here's the long snippet - the problem starts here:
This is exactly what I wanted you to see! Don't panic! Whenever you use a partitioning tool against an installed system, there's a chance of a problem, filesystem corruption and who knows what else. There is no guarantee for success. Re-partitioning of installed operating systems is risky. This is why you should always create your setup BEFORE installations, so you never have to face this kind of problem.
What went wrong?
Well, my guess is the resizing (shrinking) messed up the filesystem. No worries, we will fix it. Luckily, we can solve this one rather easily. The error message itself suggests the course of action - boot from Windows installation disc, choose Language settings, click on Repair your computer and let the built-in Windows tools do the job. Let's do it, then.
Repair unbootable Windows installation
Following the instructions, we will boot from the Windows installation disc.
Click on Repair your computer:
And you will see this menu:
Let Windows repair itself. It should do a pretty good job. Indeed, we're up and running. Windows 7 will start booting and recommend you run checkdisk against your disk, offering yet another hint that the resizing procedure messed things up a little. You should indeed let the tool run.
And soon, you'll see the login menu:
The problem ends here ... Looking good.
Windows 7 recovery console
Now, after you're convinced that it works, let's see what else the recovery console can do. When booting, hit F8 - or wait for a failing system to offer the console. Select Repair Your Computer and wait for the rescue system module to load.
Now, before you do that, please take a moment to go through all other available options. There's boot logging and debugging, starting with the last good known configuration, disable driver signature enforcement, and several other features. If you're not really sure what they do, just go with the default, which should be enough in most cases.
Choose your language:
Enter your password (for any administrative account):
Next, go through the options.
What do we have here?
System Repair is your best bet. Let Windows do all the hard work.
System Restore will try to restore Windows to an earlier time.
System Image Recovery will restore a system image, but only if you use Windows for this. It will not restore images created in third-party imaging software.
Windows Memory Diagnostic is like running memtest on Linux.
Command Prompt is what it is - a place to hammer wise commands, like fixmbr and similar. We will see a few more Windows 7 specific options a while later.
We want the first option. Windows will try its magic:
Luckily, Windows 7 will find a problem and fix it.
Now, some other tricks ...
Fix MBR
Windows 7 uses a somewhat different notation for fixing the broken MBR. The idea remains the same, but the command line has changed a little.
bootrec /fixmbr
Optionally, you may also need to run bootrec /fixboot. Voila!
Other things you want to do ...
Let's review several other tools, as well as the useful tips and tricks for system health.
Backup strategy
You should have a sound and well-tested strategy for your system, as well as data. System backup refers to imaging. Data backup is, well, self-evident. Very important and often neglected by users, until a disaster, often a simple hardware failure, strikes.
On top of that, you may want to backup your browser data and your drivers. To this end, there's Double Driver, which will neatly package all of your system drivers into a single archive. And if you happen to be using Firefox, then you will like the FEBE & CLEO extension combo, which can backup your profile, completely or selectively. On my recommended Firefox addons list.
Run Linux (any Linux) as your Windows rescue
Sounds weird, but it works. Whether you go for dual-boot or run Linux from live CD, it can help you fix your Windows. The problem may only be the bootloader, but you may also require salvaging data or cleaning up malware. There are many Linux tools that can do the job, we'll mention just a few. Taken from my Forensics introduction article:
This is a live CD specifically geared toward rescue and recovery. The tools package includes some of the most important tools available for Linux user, like GParted, PartImage, Grub, Lilo, sfdisk, TestDisk, and more.
PartImage is a powerful, friendly disk/partition imaging software, allowing you to quickly and easily backup and recover your entire disks or individual partitions, including the Windows NTFS filesystem. PartImage is included with the SystemRescueCD.
Speaking of imaging software, CloneZilla is another powerful candidate for disk / partition backup and recovery; see the tutorial above.
Another extremely important tool is TestDisk. This tool allows to recover lost partitions, make not-bootable disks boot again and restore delete files. It is one of the more effective and powerful utilities on the market. When everything else fails, TestDisk won't. TestDisk is included with the SystemRescueCD.
Super Grub Disk is intended to run from a floppy disk or CD and is used for system rescue. Most importantly, it can be used to restore boot loaders, including GRUB, LILO and even Windows boot loader. Super Grub Disk works with both GRUB Legacy and GRUB2.
ms-sys
This is another nifty tool that can do the job. I have not introduced it before, so now it seems like a good time. ms-sys is a Linux program for writing Microsoft compatible boot records. The program does the same as Microsoft fixmbr to a hard disk or sys <letter> to a floppy or FAT partition, except that it does not copy any system files, only the boot record is written. For example, to fix Windows MBR, run the following command:
ms-sys -m /dev/sda
This is assuming that Windows is located on the first device, as it ought to be. Furthermore, you need to be familiar with Linux notation to do this. And we're done.
Conclusion
I hope you liked this tutorial. As most support & help articles, it's not just a narrow-minded point-and-click guide. It embraces the recovery doctrine as a whole and tries to present a universal approach to potential problems.
You now have specific commands for both Windows XP and 7, full live CD systems capable of repairing your damaged Windows installations and you've learned about a handful of Linux programs that can do the trick. Most importantly, you are familiar with the Windows recovery console and what it can do. If you ever need to restore your Windows, for whatever reason, you have the tools for the job, may you never require them.
That would be all. See ya around.
Cheers.