Just a thought

Booting XP from second drive

Posted by stringofthoughts on April 27, 2009

I’ve 2 IDE disks in my computer. I used to have all my OS installed in one disk and use the other one as data disk. The problem was when say gurb fails or HDD fails i loose both OS simultaneously and that’s not a good situation cuz life without computer and internet sucks. So I installed Linux on one drive and XP on other but now there was another problem. See Linux was in my master drive and XP on slave drive. The problem with XP is that it need to be in the primary disk to be booted. So it can’t be booted from grub just by chainloading NTloader. The other option was to modify NTloader to boot linux from it, but the catch here is NTloader is not designed to boot anything but windows (typical behavior of Microsoft, thinks windows is the only OS). So for past 6 months i’ve been switching HDD priority in BIOS to boot into the OS i want. It’s not a very good way to go but it worked for me. Initialy it was a little annoying but later it became a habit.

Recently i found out that it’s possible to boot XP from the second drive using grub as primary bootloder. I’ll explain. My 2 IDE drives are connected to Primary IDE channel. Disk1 say (hd0) is Master drive and has linux+grub installed in it. Disk2 say (hd1) is slave drive with windows XP and it’s bootloader installed.

Disk1 (hd0) Linux Master_drive
Disk2 (hd1) Windows Slave_drive

From sudo fdisk -l I got windows installed in (hd1,0)

I added these lines to /boot/grub/menu.lst

title Microsoft Windows XP Professional
map (hd0) (hd1)
map (hd1) (hd0)
rootnoverify (hd1,0)
chainloader +1

I’ll explain the commands. For windows to boot it should be on the primary disk. Map command virtually switches the primary and secondary disks. Something that we do physically by changing the jumper settings or putting drives in cable select mode.

map (hd0) (hd1) // mapping primary disk hd0 to secondary hd1
map (hd1) (hd0) // mapping secondary disk hd1 to primary hd0

Remark :: map command doesn’t work if your SATA drive needs special drivers.

After these commands now the slave drive with windows XP is the primary drive. rootnoverify (hd1,0) sets the GRUB’s root device, makeactive sets the active flag in the partition (hd1 in this case), chainload loads windows bootloader.

This is also possible with two SATA disks but if your system has one SATA and one IDE then i can’t say it would work. This was the problem posted on ubuntu forum from where i learnt about booting windows from second drive but it didn’t work for 1 SATA and 1 IDE drive.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: