Restore access to your Linux system after a Windows install

GNU/Linux (image copyright Larry Ewing, Simon Budig and Anja Gerwinski)

If you ever make the big mistake of trying to install a Microsoft operating system on your machine, you will know that lots of things can go awfully awry.

Microsoft seems to believe that there is there is no other operating system but Microsoft Windows. Consequently, the Windows installer disregards existing operating systems other than Microsoft Windows, covertly overwrites the master boot record and prepotently changes the bootable flag to its own partition.

The net result of a Windows XP installation is (besides the obvious waste of disk space) that you can no longer boot into your pre-existing operating systems.
This is very annoying when you need to access important data or you want to work with other (better) operating systems.

I unfortunately had to go through the torment of installing Windows XP on my laptop and then try to restore the ability to log into my Linux system.

After Windows XP installation program screwed up with my partition table on my primary hard-drive, I could no longer boot into my trusted Linux system.

But not to fear, with a little ingenuity and the Swiss-army Linux distribution Knoppix I quickly and painlessly restored GRUB to the boot sector and logged back into my Linux system.

By the way, Knoppix is not a requirement, any other Live-CD Linux distribution will do, provided it comes with grub, and the grub-install program in particular.

To restore GRUB, you will need to mount the partition that holds your /boot directory (let's say /dev/hda1).

mount /dev/hda1 /mnt/hda1

Then, all that needs to be done to restore GRUB is running grub-install

grub-install --root-directory=/mnt/hda1 /dev/hda