How to Dual Boot with Linux and Windows XP

Published December 01, 2004

NOTE: This article was written in 2004 and a lot of things may be outdated here.

You can set your computer to dual boot either with the Windows NT bootloader, Grub, LILO or any other bootloader.

My Windows partition is at /dev/hda1 and Linux partition is at /dev/hda2. The boot is at /dev/hda4.

Grub as the bootloader

I use Gentoo, so I'm listing the steps to install and configure Grub for Gentoo users.

First, emerge Grub with

emerge grub

Edit /boot/grub/grub.conf:

title           Gentoo
root            (hd0,1)
kernel          /kernel-2.6.15-gentoo-r4 root=/dev/hda4 vga=791
boot

title           Microsoft Windows XP
rootnoverify    (hd0,0)
makeactive
chainloader     +1

NOTE: In my laptop, /dev/hda1 is (hd0,0) /dev/hda2 is (hd0,1)

LILO as the bootloader

If you want to let LILO be the bootloader, just click on 'yes' during the installation; thats what I did.

I selected graphical LILO as the bootloader for my computer at home and GRUB at work in the Plant Pathology dept where I worked (until 2002).

Windows NT bootloader as the default bootloader

However, if you want Windows NT bootloader as your default bootloader, follow the steps below.

  • Windows 2000 has to Own the MBR - you can't install LILO in it.
  • When you install linux, install LILO on the root install partition instead & make a boot disk when prompted.
  • Then, when linux is done installing, boot it from the disk.
  • Mount a new msdos floppy and type:

    dd if=/dev/hda6 bs=512 count=1 of=/linux.bin

    (here, hda6 is the root partition, you can substitute it for your own linux root partition)

  • Now you need to copy the MBR to the floppy

        mount -t msdos /dev/fd0 /mnt
        cp /linux.bin /mnt
        umount /mnt
        

  • Remove the floppy from the drive and reboot in Windows 2000.
  • Copy the linux.bin file from the disk you just used to the root of your C drive.
  • Edit c:\boot.ini and add an entry at the end that looks something like this: c:\linux.bin="RedHat 7" or whatever you want to call it.
  • The NT bootloader will now launch LILO when you choose RedHat from the menu.

Recovering a lost LILO

Boot into Linux using a Linux boot floppy and type

/sbin/lilo

Removing LILO

If you have Win 95/98, type FDISK /mbr

If you have Windows 2000, boot from the Windows 2000 CD and type fixmbr

Or else, from Linux, type /sbin/lilo -u

Removing Grub (and installing LILO)

If you have Grub as your default bootloader and want to replace it with LILO, here is what you do.

To remove Grub, you have to create a /etc/lilo.conf that describes your setup.

Type lilo -v to replace Grub with LILO.

Removing Grub (and installing Windows bootloader)

If you have Grub as your default bootloader and want to replace it with the Windows bootloader, you have two options.

Execute the fixboot command in Windows. It may work.

Or else, reinstall Windows.

Related Posts

If you have any questions, please contact me at arulbOsutkNiqlzziyties@gNqmaizl.bkcom. You can also post questions in our Facebook group. Thank you.

Disclaimer: Our website is supported by our users. We sometimes earn affiliate links when you click through the affiliate links on our website.

Last Updated: December 01, 2004.     This post was originally written on December 02, 2004.