I ran into an already reported problem with a Fedora 6/ XP - dual boot installation, where two disks are used. I fixed it but would like to understand what the installer did wrong in the first place.
The system is a HPa1250n with preinstalled XP on the first disk (240GB). I installed a second disk (160GB) a year ago and put Suse on it. There wasn't a problem with dual boot, but I don't remember what I did right then. On the second disk I had a partition formated with FAT32 to use from either Linux or Windows and the rest a reiser partion for linux.
For the new installation over the old Suse, I didn't make changes to the disk partitions, and so I have (copied and simplified, from the view in gparted - Gnome partition editor):
240 GB disk:
/dev/sda1: fat32 8 GB
/dev/sda2: ntfs 225 GB
160 GB disk:
/dev/sdb1: fat32 32 GB
/dev/sdb2: ext3 95 MB /boot
/dev/sdb3: unknown 117 GB (LVM for Fedora 6)
During installation, the Fedora installer by default proposed to write the boot sector of the first disk, to /dev/sda. I let it do this.
Afterwards I couldn't boot anything ("grub error 17" were the last words).
I tried then the method of switching the disk order and put the boot sector in /dev/sdb1, which was the other possibility provided by the installer. The reversed order of the devices can be seen in the file /boot/grub/device.map:
Code:
# this device map was generated by anaconda
(hd1) /dev/sda
(hd0) /dev/sdb
Furthermore, in the bios settings, the disk order is now interchanged. Bios looks first at the boot sector of the /dev/sdb disk. After the installation, I could boot Fedora 6 but XP would just hang. I read around here and in various places and found the work around to be an editing of the grub.conf file in /boot/grub/grub.conf (see red lines):
Code:
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,1)
# kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
# initrd /initrd-version.img
#boot=/dev/sdb2
default=0
timeout=5
splashimage=(hd0,1)/grub/splash.xpm.gz
hiddenmenu
title Fedora Core (2.6.19-1.2895.fc6)
root (hd0,1)
kernel /vmlinuz-2.6.19-1.2895.fc6 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.19-1.2895.fc6.img
title Fedora Core (2.6.18-1.2798.fc6)
root (hd0,1)
kernel /vmlinuz-2.6.18-1.2798.fc6 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.18-1.2798.fc6.img
title WinXP
rootnoverify (hd1,1)
map (hd0) (hd1)
map (hd1) (hd0)
makeactive
chainloader +1
Note that the
red lines were inserted later by hand to make it actually work. Without those lines XP wouldn't boot.
Ok it works all right, but I still wonder: In the first attempt I had obviously overwritten the MBR of the big disk /dev/sda. I did't restore it or anything. I don't have an XP rescue disk, it's not provided with the PC, so I could not restore the MBR. Which is why I made it the secondary disk.
However, the documentation of grub makes the following point about this remapping business: (from
http://www.gnu.org/software/grub/man..._002fWindows):
If you have installed DOS (or Windows) on a non-first hard disk, you have to use the disk swapping technique, because that OS cannot boot from any disks but the first one. The workaround used in GRUB is the command map (see map), like this:
grub> map (hd0) (hd1)
grub> map (hd1) (hd0)
This performs a virtual swap between your first and second hard drive.
Caution: This is effective only if DOS (or Windows) uses BIOS to access the swapped disks. If that OS uses a special driver for the disks, this probably won't work.
Considering the above comment, I would have prefered to leave the disk order as it was - which is the default method in the Fedora installer - even though the disk switching scheme works for me right now.
So my question is:
What exactly does the Fedora installer wrong if the default method is used?