As most of you know I write for Bright Hub. I write for the Linux, hardware and Windows channels as well as small Business security which also is Windows oriented. Unfortunately this also means I have to have Windows installed on at least one of my boxes. I had to do so on my secondary slave. The box I’m installing Windows on has three HD’s and one CDrom. The first and second HD are installed on Primary master and slave. The Secondary master is the CD drive the slave is the Windows HD.
So Just Install It and that’s that right?
No not that simple. Yes you have to install it, and the easiest way to do so is by unplugging the drives with Linux on them. After you install Windows (XP or Vista take a pick) make sure Windows boots up and install all the millions of updates. The Difficulty doesn’t come with installing Windows it’s telling Grub what drive an partition has Windows on it.
How To Get Grub To Recognize Where Windows Is
You have to understand how Grub looks at the drives. If you run fdisk:
sudo fdisk -l
This command tells us that the frist drive is sda the second drive is sdb and the third drive is sdd. There is no sdc because our secondary master is the CD drive. In Grub this translates to the following:
sda → hd(0,0)
sdb → hd(1,0)
sdd → hd(2,0)
This could also be:
hda → hd(0,0)
hdb → hd(1,0)
hdd → hd(2,0)
So what does it mean hd(0,0) hd stands for hard drive (duh) 0,0 stands for drive 0 partition 0.
So Use The Grub Default For Windows Right?
Wrong. The default for Grub is the following:
title Windows 95/98/NT/2000 root (hd0,0) makeactive chainloader +1
This how ever doesn’t work. Because of the fact that windows is installed on the secondary slave, which would be hd(2,0). Okay so just change (hd0,0) to hd(2,0) and now it works right? Wrong this will cause an Grub Error 13: “Invalid or unsupported executable format”. We are missing two crusial lines of code here:
title Windows XP root (hd2,0) makeactive map (hd0) (hd2) map (hd2) (hd0) chainloader +1
Windows will only start from the first hard drive. To get this to work we have to map hd2 to hd0. Now Windows will believe it’s on hd0 even though it’s on hd2.
As always if you have any problems please post a comment below. If it worked for you then let others know by posting a comment below.