Lesson Learned: Dual boot XP and Fedora 9
This post captures my recent experience in getting my Dell XPS Gen 3 to support dual boot of Windows XP (Professional) and the Fedora 9 Linux distribution.
I searched quite a bit on the internet and found, of course, a variety of opinions regarding how to setup this type (dual boot) of configuration. I thought I would post some take-away lessons here, in case someone might have an interest or need to perform something similar.
<<Lessons Learned>>
Summary - Top Three Lessons:
(1) Use a separate hard disk for the Linux OS
(2) Never mess with the MBR of a XP/Vista disk: Windows OS own the MBR.
(3) Use grub to create a hardware independent /boot (active) partition to start Linux
(4) Use the NT Loader (NTLDR) to start the Linux OS via a boot partition.
(1) Use a separate hard drive for booting Linux
The main lesson, is that given the cost of a new hard drives (around $100 for 500 GB) it seems to make sense to get an additional drive and use that to install the Linux distribution. Part of the drive (I used about half) can be setup as NTFS-FAT32 "exchange" file system to allow the transfer of files between XP and Linux (Fedora 9) This allows you to maintain you Windows partition and, most importantly, leave the master boot record (MBR) unaltered. Microsoft operating systems, for better or worse, have a strong affinity to the MBR: just deal with it. (See following lessons on how to do exactly that).
In my case, I had an existing 256 GB Serial ATA (SATA) drive that shipped from Dell with the XP Professional partition. Since I have modified it extensively and since it contains very important and sensitive data and documents I did not want to even touch the XP partitions or their existing data. This drive is installed as BIOS drive 0 (the first drive). I installed a new 500 byte SATA drive as BIOS drive 2 (the third drive).
There is currently no BIOS drive 1 -- I skipped the second drive on purpose to see if Fedora can properly handle dealing with the BIOS setup of drives. Note, also that I love the Dell utility partition that ships on the XPS class of machines. It's a bootable partition that allows you to diagnose hardware problems that might take quite a while to figure out otherwise. For example, if your Dell shows the “blue screen of death” you can start the diagnostic tool, select the troubleshooting test, and identify your problem (hardware) in a less than an hour. (Well, OKAY, in many cases that I've seen anyway). After installing the new drive and connecting the cables, the BIOS setup needs to be used to enable the new drive. Again, as BIOS SATA drive 2, in my case.
I then booted XP Professional and created a NTFS partition (could have used FAT32 but again, I wanted to validate that the Fedora 2.6 core can support NTFS file systems as advertised). Basically, I split the new disk into two 250 GB partitions: first, was the NTFS partition (to be shared between XP and Fedora); second, an unused (by XP) and unformatted partition to contain the Linux OS. This second partition is used to contain the Linux installation - setup using the standard Fedora installer (with a slight twist, as described in lesson three below).
I then downloaded and burnt the Fedora DVD ISO onto a bootable DVD (could have used a series of CD -- but hey, one DVD is worth a few dozen CDs). This was used to install Fedora 9 into the second set of previously unoccupied partitions on the second physical drive, as described above.
(2) Do not mess with the master boot record (MBR).
The master boot record on a hard drive tells the BIOS how to load software that can bootstrap various operating systems. For some reason, Windows operating systems (dating back to DOS) have a strong affinity to the MBR. Therefore, never, ever, mess with the MBR on a disk drive. There are better ways to boot OS that messing with the MBR and its associated data. If you mess up the MBR in anyway, then you might not only lose the ability to boot from a disk, but could scramble the partitions and data as well. Exactly how to enable the NT loader (NTLDR) to manage the boot process for Linux follows below, for now, just understand that when a disk ships with a vendor installed (or if you install or ever plan to install) any Microsoft OS, then just accept the fact that Windows owns the MBR and let it go at that.
In scanning the various postings on dual booting a common pain point was corruption of the MBR and the angst resulting from the partial or total loss of the Windows OS and its accompanying data and files. This was acutely the case when people tried to install both Windows and Linux on a single physical drive. Please see lesson one above as to why this is really not worth the risk. This lesson distills that experience into a simply principle: DO NOT mess with the MBR.
Please note that the MBR is different for each physical disk, so if you have the inclination you can use the MBR to boot Linux, and given that you've accepted lesson one (use separate disks for XP and Linux) you'll be in fine shape. However, most BIOS setups require that you monkey with a boot manager at startup time to select an alternative boot device, if you don't want to use the MBR on the first physical disk.
On a DELL there is a separate BIOS tool - the Dell boot manager - installed in a very small partition at the beginning of the first drive in your system (assuming of course, you have not wiped it since you got it from Dell). If you press a certain set of function keys (F12 on my XPS Gen 3) you can select the boot device. This is not something I wanted to require - and besides, my wife and kids would have rioted at the idea of having to do that when using the family computer! Therefore, (and since I was in no mood to be stoned to death by the family) in the remainder of this thread, I will not be discussing that version of dual booting from two physical drives. Please let me know if you've had any success with that approach.
(3) Use the Linux grub loader to start using a boot (/boot) partition.
The Grand Unified Boot Loader (grub) is a multiboot loader: the first piece of software that runs when a computer starts (boots). In general, boot loaders (such as grub or the NT loader - ntldr) are responsible for loading and transferring control to the operating system kernel. The OS kernel can then access the remainder of OS to accomplish the various functions needed to operate the computer.
When installing Fedora 9 from the installation media, after a certain point in the process you'll be requested to setup partitions on the target installation disk (/dev/sdb, in my particular case; you're case is probably different). By default the 2.6 Fedora core will setup a 2 GB partition containing a boot partition, that contains grub, and a root (/) partition, and a swap partition (normally 2 times the physical RAM) on the installation volume.
In addition, and this is the critical note in these lessons, the Fedora 2.6 core will by default attempt to install entries into the MBR (see the previous lessons) that enable booting. Since, this can mess with Windows (XP/Vista/DOS) or other partitions; I don't recommend this route for the reasons described above. Be sure to select the second physical disk and then review and modify the partition layout using the advanced configuration. Instead of using the MBR (the default under the Fedora 2.6 core) install grub as the secondary boot loader. This will install grub in the first sector of the Linux boot partition. The final lesson will demonstrate how to establish linkage between the MBR on the first physical disk (remember, this is being reserved for exclusive use by Windows OS by the two prior lessons) and the /boot partition that is setup using grub.
By the way, and this could be particular to my Dell XPS Gen 3, the Linux 2.6 core incorrectly interpreted my BIOS setup (probably a bug in the core that is encountered when the drives installed are not directly enumerated with the correspond entries in the BIOS - recall from above that I setup the second disk as the third disk in the BIOS; there is no second BIOS disk in my system: BIOS drive 0, the first drive; and BIOS drive 2, the second drive). Fedora, swaps the BIOS drive order and reported the second drive (BIOS drive 2) first, and the first drive (BIOS drive 0) second in the BIOS order. I had to switch this order to get grub to boot properly. Otherwise, once the steps in lesson four below were completed, grub reported a geometry error when attempting to boot. This error is routinely identified with problems in dealing with unusual BIOS setups when using the Fedora 2.6 core. Hopefully, it will be fixed in a later version of the core.
The remainder of the Linux installation can proceed per the Fedora directions from this point forward.
(4) Use the NT loader to chain the Linux boot loader (grub)
Once you completed the normal Fedora install, remove the bootable install DVD and reboot to XP. Since you have not messed with the MBR at this point (per the design and requirements of the above lessons) you will not have any options to actually boot Fedora at this point in the process. However, the following techniques can be used to install the Linux boot partition into the NTFS (or FAT32) file system in such a way that it can be accessed by the NT loader (NTLDR).
(a) Format a Windows floppy to transfer the /boot partition information to XP/Vista. You'll probably want to format and label the floppy, say, GRUBLOAD. Shutdown Windows XP at this point, and reinstall the Fedora installation DVD; once it boots use the “rescue” mode to boot to a command line running from the installation media. Install the above created floppy at this point.
(b) Assuming that you've identified the boot partition on the second disk (/dev/sdb2 in my particular case; you will probably have a different UNIX device associated with your computer), then enter the following commands to copy the bits of the boot partition to a binary file that can be appropriate used by NTLDR.
chroot /mnt/sysimage
mkdir /media/floppy
mount -t vfat /dev/fd0 /media/floppy
dd if=/dev/sdb2 of=/media/floppy/grub.bin bs=512 count=1
cp /boot/grub/grub.conf /media/floppy
umount /media/floppy
In the first step you are gaining root-level access to the limited kernel running from the installation media. In the second step you are creating a directy that functions as the target of a mount point for the floppy drive. Next, you are mounting the floppy disk device onto the floppy media mount point, using a format compatiable with DOS (vfat). The dd statement copies the bits of the first sector of the boot device (/dev/sdb2 in my case; yours will be a different device, so make sure you know what device represents the boot partition). The block size (bs) and count options insure that you are formating the bits being copied so as to be accessible as a Windows binary (.BIN) file. The copy of the actual grub configuration file, is optional - its done just for reference, so you can know what the grub configuration you are booting looks like. By the way, if you inspect this file using vi (say) it will help you determine which device to use as input to the dd command. Finally, unmount the floppy media device. Its important that you do this before ejecting the floppy, as its contents might be partially written to disk otherwise.
(c) Remove the floppy and Fedora installation media. Reboot into XP.
(d) Once you've logged into XP, re-insert the floppy drive and then modify the boot.ini - after making a suitable backup of course.
(e) Enter the following line at the end of the boot.ini file
(f) c:\grub.bin=”Fedora 9”
(g) Copy the grub.bin file from the floppy (a:\) drive to c:\ (root directory on the primary NTFS volume)
(h) Remove the floppy drive and reboot the system using the power button.
(i) When you reboot the system you will see the NTLDR prompt that asks you to select the OS you want to boot, either Windows XP Professional (or other Windows OS) and Fedora 9.0 (per the left side of equals in a prior step). If you select the second entry, control will then be transferred to the grub boot loader menu, from which you can then boot your Fedora installation.
I hope someone finds this quick set of lessons learned useful.