I signed up with Microsoft to beta test the next version of Windows, Windows 7. I dual boot my PC between Linux and Windows, although I spend nearly 100% of my time booted into Linux. To make things easy, when I setup a new computer, I install Windows first and Linux second. Linux handles setting up the dual booting and everything works great.
I installed Windows 7 on two PC’s that already had Linux installed. On my laptop, I simply wiped out the XP install. On my desktop at work, I used a gParted Live CD to move and resize my partitions to make room for Windows 7, since I wanted to keep my XP install intact.
After installing Windows 7, I was left with the Windows 7 boot loader that completely ignored the existence of Linux on my computers. The laptop simply booted directly into Windows 7, and the desktop only allowed me to select between Windows 7 and Windows XP.
Fixing GRUB was a pretty easy task. To do so, I grabed my Linux install CD (Mine happened to be Kubuntu 8.04). I booted into the live CD desktop. I opened up a terminal window and at the comand prompt, I typed:
The “sudo” part is important. If you don’t run grub with root privelages, it will tell you that the selected disk doesn’t exist.
At the grub prompt, type:
After you type the ( key, press the tab key. Most likely, it will populate with hd0 (unless you have more than one physical hard drive in your computer). If there is more than one hard drive in your computer, you will be presented with a list of available options. You should see on the screen:
Press the tab key again. You will be presented with a list of partitions on the drive. You will want to select the one with your linux installation on it. For me, I completed the line:
Press enter and you’ll be returned to the grub prompt. If you want to reinstall GRUB onto the MBR (where most people put it), the next comand is:
Once GRUB is reinstalled to your MBR, you can type “quit” at the GRUB prompt. Restart your computer, and boot back into your Linux install normally. If you’re fussy like me, you’ll want to edit your /boot/grub/menu.lst to say Windows 7 instead of Windows XP.
On a side note, if you’re tripple booting Windows XP, Windows 7, and Linux, like I am at work, you will only have two options in your GRUB menu: Linux and Windows. If you slect windows, you’ll be presented with the Windows boot loader to select between Windows XP and Windows 7.
I’m sure it’s possible to boot directly into each from GRUB, but I don’t boot into windows enough to make the extra keystroke that much of an inconvenience.