Vista and XP respond to Grub's map function differently

I wonder has anyone anything to say about this puzzling behaviour:

When I install XP on drive 1 partition 1 and then unplug the drive and plug it back in as drive 2: then I can edit an entry for it into /boot/grub/menu.lst that will boot it from Grub, like so:

title Windows XP on drive 2
map (hd0) (hd1)
map (hd1) (hd0)
rootnoverify (hd1,0)
chainloader (hd1,0)+1

Then if I replug it as drive 1 and add Vista to the mix on partition 2 so that vista lays its boot codes into partition 1 (as it must or it can’t boot), thereby forming a Microsoft multiboot system – and then I reposition the drive as drive 2 – well you would expect the Grub code above to boot the pair (xp and vista) from drive 2. And that’s quite correct. It boots fine to the Microsoft multiboot menu.

Well what puzzles me is that this alternate version of the Grub code works just as well as the version above, once I have installed Vista; viz:

title Windows XP on drive 2
rootnoverify (hd1,0)
chainloader (hd1,0)+1

So my question is: does anyone know why Grub can boot the same partition using either of the codings above when Vista code is in the boot partition BUT only the first version of the Grub code above works when XP code is in the boot partition.

Any advice, similar experiences, thoughts?



I’m not sure I know the answer; don’t have Vista, but:

Which disk & partition has the boot flag?

run Parted Magic 2.2 & that GParted & it will show it; you may have 2:eek:

Chainloader boots like the 1st 613 bits of the MBR & hands off @ +1 (614th bit) to the chosen OS (I’m not sure of those numbers; it’s been a while). It would have to see a MBR; do you have one on both drives?

saikee @ “How to install and boot 145 operating systems in a PC” How to install and boot 145 operating systems in a PC - JustLinux Forums uses:

title Vista @ hdc3
root (hd1,2)
hide (hd0,0)
hide (hd0,1)
hide (hd0,2)
hide (hd1,0)
hide (hd1,1)
unhide (hd1,2)
map (hd1) (hd0)
map (hd0) (hd1)
chainloader +1

saikee knows his stuff; may be worth posting/emailing to find the knowledge you are seeking.

Good luck:)

Thanks snakedriver - interesting article.
I’m having no difficulty booting xp or vista on either drive, whether installed on drive 2 using the windows partition on drive 1 to store the bootloader files --or-- installed on a drive masquerading as drive 1 and later moved to drive 2 or higher than 2 with the bootloader files in the lowest partition of that drive.

Boot flags aren’t important in the scenario I use: which is to store Grub’s code in MBR with pointer to /boot/grub/menu.lst buried in that MBR code.
Boot flags are very important, crucial, when a user opts for “boot from root partition” or “boot from custom partition” rather than to “boot from the MBR” – because then the Grub code is different – it’s a bootstrap to the active partition (which of course needs to be labelled active or Grub gets lost).

What puzzled me was that vista doesn’t care whether we use the map () () function in menu.lst for drives that aren’t the first drive. Vista sorts it out and works either way.

I’ve come to the conclusion that vita’s bootloader (which uses a different standard from 2000/xp which used no standard), that vista re analyses the drives for itself, ignoring any or Grub’s manipulation of drive numbers.

Which is very interesting

I’ve also noticed strange behaviour using grub to boot Vista and XP off a second HDD…

My setup is :

Boot HDD 0(set in bios) with grub in MBR
has Mac OS X and Ubuntu
HDD 1 has Vista Boot Manager in MBR and
configuration files on the first primary-active partition which has Windows XP on it.
Vista is on the second primary partition of HDD 1.

I was basicly wondering the same thing how is it that using map to swap the drives in menu.lst has no effect on booting MS Vista
i.e. I can boot using
map (hd1)(hd0)
map (hd0)(hd1)

and also using


Vista seems to load all the same which ever you chose.

But testing further it seems that there is a difference.
Boot off without swapping and then once in Vista I tried bcdedit(run cmd as admin first) and I got a message that "
the config store file could not be found" or something similar. Then I tried changing menu.lst to swap the HDDS before boot and
this time bcdedit found the vista boot manager config files and displayed the entries correctly.

My Vista boot manager is located on the first partition of the second HDD and I am guessing that unless you swap the HDDS the bcdedit looks
for the first partition in the wrong HDD.
This also gives an odd message in EasyBCD 1.7.2
that something is wrong with my MBR and that its not a vista MBR which is not true.

Hope someone with more knowledge can explain what the difference is on a OS level…