Saturday, 30 October 2004

Dual Booting Windows XP/2000 and Red Hat Fedora Core 2

There are two ways in which you can dual boot between windowsXP/2000 and Linux.
  1. Install the boot loader in the Master Boot Record (MBR)
  2. Install the bootloader on the linux partition.
The first method is the easier of the two. But if by any chance, you descide to Hibernate your computer while in WindowsXP for example, then your MBR is overwritten by windowsXP and you will be unable to boot into linux using your bootloader.
Here I will explain how to overcome this setback by using the second method. That is installing the bootloader (LILO or Grub) on the linux partition . Here I am explaining the steps with respect to RedHat Fedora Core 2 distribution. But the steps are equally valid for any linux distribution.
The procedure is as follows:
  • Install WindowsXP/2000 first.
  • Now install Fedora core 2. I installed it in /dev/hda3 ; which was my linux ext3 partition.
  • While installing, enforce LBA32. This is necessary only if you intend to install the bootloader in a partition above 32GB. In my case (I have only 12 GB total) it was not necessary.
  • At the section where the installer asks whether you want to install a boot loader; select yes (Fedora comes with Grub as default boot loader) and in the advanced settings, select your linux partition as the place to install the bootloader. In my case it was /dev/hda3. Nowcomplete the Fedora core 2 install.
  • Reboot the computer and load again from the first CD in your Fedora Core 2 distribution.
  • At the boot prompt, type:
    boot: linux rescue
    ... And boot into rescue mode. Fedora will automatically try to detect your linux partition ;boot you into single user mode and mount your linux partition in the /mnt/sysimage directory.
  • Here when you get the root prompt, issue the following commands:
    # chroot  /mnt/sysimage
    # dd if=/dev/hda3 of=linux.bin bs=512 count=1
  • Now insert a floppy and copy the linux.bin file into it as follows:
    # mcopy linux.bin a:
  • Type exit 2 times - which will reboot your machine. Now remove the FC2 CD and boot into windows XP/2000.
  • Get to the command prompt and copy the linux.bin file into the C:\ drive.
    A:\> copy linux.bin  C:\
  • Finally add the following line to the boot.ini file residing in the C:\ drive.
    C:\linux.bin=" Red Hat Fedora Core 2"
  • Reboot machine and choose "Red Hat Fedora Core 2" from boot.ini menu, which will cause NTLDR to load first 512 kb from Fedora Core 2 boot partition.
  • Select from grub menu the desired kernel and press Enter.
Now even if you hibernate while in Windows XP, your bootloader will not be overwritten and you will be able to boot successfully into Linux.

No comments:

Post a Comment