Wednesday, January 6, 2010

Using GRUB to boot a second Win XP hard drive

Following on from my earlier success with GRUB to provide dual boot, (Ubuntu Linux - hd0,4 and Win XP hd0,0 in separate partitions on the same hard drive), I decided to add a third option - that being to boot another Win XP installation (hd1,0) which exists on a second hard drive with one partition and a Windows Master Boot Record. (I had previously only been able to boot this hard drive through switching the BIOS settings for the 1st hard drive, but now that was becoming rather tedious).

I edited the GRUB menu.lst to point to the second Win XP installation  hd1,0 and then makeactive. Sorry too much dispela tru. Dispela lookim - for some unknown reason GRUB would not boot hd1,0 even though testing proved it was being accessed. GRUB would always revert to booting Win XP on hd0,0.

How The Heck Did I Get GRUB to optionally boot the second Win XP Installation?

Well, this fix required some help which I found readily available on http://www.ubuntuforums.org/.  I also found a very good relevant article on Linux Journal. http://www.linuxjournal.com/article/4622
BTW, just confirming GRUB partition numbers are always 1 less than Linux numbering. The conversion for my machine therefore is:
/dev/sda1 = hd0,0 (First Win XP installation)
/dev/sda5 = hd0,4 (Ubuntu Linux installation)
/dev/sdb1 = hd1,0 (Second Win XP installation)
  1. In Linux, back up menu.lst using cp /boot/grub/menu.lst /boot/grub/menu.lst.bak (or similar)
  2. Edit menu.lst using sudo gedit /boot/grub/menu.lst
  3. Change the second Win XP bootstrap loader instructions to read:
  4. title Windows XP #2 (or similar)
  5. rootnoverify (hd1,0)
  6. map (hd0) (hd1)
  7. map (hd1) (hd0)
  8. makeactive
  9. chainloader +1
  10. Save menu.lst and exit.
  11. Windows XP #2 should now boot normally from GRUB
With acknowledgement to the Linux Journal article referenced above, it seems the rootnoverify command is for OS filesystems not specifically recognized by GRUB, so that GRUB will not try to mount the partition. The chainloader command will use the first sector of the partition of device (hd1,0) and attempt to boot whatever it finds there. This is a common means of booting OS'es that install their own boot loaders in the first sector of the partition where they are installed (this is sometimes called the partition boot sector or PBR).

The makeactive command sets the active flag in the partition table for the device specified by the root command, as some operating systems, like Win98, require.

I found a really excellent article at http://www.oculon.org/hijinx/linux/grub.htm which uses mapping in system configuration very similar to mine, without rootnoverify being used. I plan to try menu.lst without the mapping, and with the mapping but with rootnoverify changed back to root. I'll keep this blog posted.

A very useful GRUB resource can be found at https://help.ubuntu.com/community/GrubHowto

So that's How the Heck I Fixed that, and I'm now much happier with the start up options.

ooRoo
Nifty Nev

No comments:

Post a Comment