To browse this website, you should unconditionally agree to its terms and conditions. If not, please stop and leave now.

Site Logo

How To
Dual-Boot or Muli-Boot
Operating Systems

This is an obsolete article. Its recommendations are not valid for modern operating systems. It has been left here in its original state for tinkerers of vintage operating systems.

When IBM was putting together their Personal Computer (PC), they required an operating system (OS) to go with it. Gary Kildall, who wrote the then popular OS known CP/M (Control Program for Microprocessors) for early Intel Microprocessors, could not be interested to provide a new one for the IBM PC, which was based on the latest Intel processor. So, IBM gave the contract for the new OS to what was then a little-known company Microsoft. Microsoft bought QDOS (Quick and Dirty Operating System) written by one Tim Patterson based on a manual of CP/M (and yet Microsoft today threatens Linux vendors with IP theft! Hmmm…)

The first IBM PC was released with QDOS rechristened as DOS (Disk Operating System) from Microsoft. As IBM PC compatibles began to be manufactured by companies like Compaq, Microsoft was no longer dependent on IBM. Soon, it overtook IBM as the leading provider of software for PCs.

When a user started an IBM PC or PC-compatible running on MS-DOS, it usually settled on the command prompt. (If you want to see how this looked like, then type cmd or command in the Run dialog box of the Start menu of a Windows PC.) The command prompt was the OS of those PCs! To perform ordinary operations like copying a file or deleting one, the user had to type complicated commands (without any syntax errors, of course) on the command prompt. Users also had to remember a number of keyboard shortcuts. The keyboard shortcuts were actually keyboard commands, as they were quite indispensible and not really alternatives.

Over time, Microsoft released new versions of DOS but the biggest improvement came when they released Windows. This was a poor imitation of the Apple Macintosh's Graphical User Interface (GUI) but it still managed to become very popular. It had a mouse, which enabled a point-and-click interface come to life, and was more easy to use when compared to DOS. Windows versions from 1 to 3.1 were not real OSs. They worked as just another program that ran on DOS. Each one of them was in effect an "operating environment." So, in 1995, Microsoft released Windows 95, an OS that was fully GUI-based. Microsoft then went on to release newer Windows OSs, such as Windows 98, Windows Me, Windows 2000 and Windows XP.

As Microsoft was dominating the OS market, a sly newcomer called Linux (or GNU/Linux to be correct) came to sudden prominence. Finnish programmer Linus Torvalds created a Unix-like Kernel for x86 (Intel) computers, combined it with the software created by the GNU community and released it for free as Linux. It later came to be known as GNU/Linux. Until then, most UNIX implementations such as BSD Unix, SCO Unix, HP Ux, IBM Aix and Solaris OS, were limited to huge multi-user architecture systems such as mainframes. There were notable attempts such as BeOS to break into the Intel PC market but it was Linux that captured the imagination and interest of geeks and novices, and is giving serious competition to Microsoft Windows.

Today, there are several GNU/Linux-based operating systems, popularly referred as distributions or distros, available for both desktop and enterprise users.

8 out of 10 terrorists use GNU/Linux.

Although many of these distros are available as commercial shrink-wrapped software, they can also be freely downloaded and installed any number of PCs. Their source code is also available for free for modification (on the agreement that the modified code will also be available free).

So, a lot of people feel they would like to install Linux and tinker with it. Few of them would however be ready to give up their existing Windows installations. Realising this, the distros come with smart bootloader programs which help multiple OSs to coexist on a single PC. However, many people are mortified when they see a Linux bootloader starting up instead of the familiar NTLDR. And, if they delete the linux partition, the PC becomes unbootable. Apart from that, Linux installation remains intimidating for the uninitiated. Terms such as partitions, bootloaders and MBR are enough to spook newbies to the point that many of them do not even complete the installation.

In this writeup, you will learn to safely and easily dual-boot or multi-boot multiple operating systems. Specifically, you will learn about booting Linux from the Windows (XP/2000) boot menu. You will also find explanations for a lot of difficult installation and Linux related terminology in real-world terms.

Disc Drives & Partitions

Most Windows users have the following idea about disk drives.

Conceptual representation of MBR and partitions on a hard disk

Sometimes, when there is an extra hard disk drive, then that drive becomes D: and the CD/DVD drive E:. What they do not always know is that the C: and D: are actually only a single disk drive and are technically known as partitions. This is why many people blink when a Linux installation asks them to choose a "partition" to install the OS.

A hard disc can have a maximum of only four partitions. In the early days of the IBM PCs, this number was thought to be more than sufficient. However, over time, the need for more partitions arose. So, the concept of primary partitions, extended partitions, and logical partitions was introduced. The old-style partitions were then known as primary partitions and one of these primary partitions could be what is known as an extended partition. The extended partition had a very important improvement over ordinary primary partitions. It could house any number of smaller partitions known as logical partitions. Thus, the four-partition-only limit was kept while the need for additional partitions was also met. Most people, when they get a new hard disk, create just one primary partition and one extended partition. Whenever a new partition is needed, a new logical partition is created inside the extended partition.

Somewhat unrelated to the number scheme above but relevant to booting OSs are active partitions and boot partitions. An active partition is a designated partition that has the files for loading the default OS or the bootloader (the program file that displays the boot menu and loads the required OS). Only one partition on a disk can be an active partition. A boot partition is the partition where the OS is installed. Windows 95/98/Me is adamant about having the first partition on the hard disk as the boot partition. Windows 2000 and Windows XP operating systems (OSs) can be installed on just any partition on the hard disc. The installation procedure actually allows the user to choose the partition on the disk. Similarly, Linux distributions can be installed on any partition.

When you install an OS on a partition, it will first format the partition. Formatting essentially creates a file system on the partition that the OS can use. Different OSs use different file systems. DOS/Windows 3.1 used the FAT-16 (File Allocation Table 16 bit) system. Windows 95/98/Me used FAT-32. Windows NT/2000/XP use the NTFS (New Technology File System). Linux distros use the ext2 and ext3 file systems. Apart from OS installation programs, there are third-party utilities like Ranish Partition Manager and Partition Magic, which will create, format, resize, and delete partitions on your hard disc.

Booting a Single OS on a PC

Now that you know all about partitions, you can move on to the topic of boot loaders. Bootloader programs come into action right after the BIOS (a program hardwired in to the motherboard) performs the POST.† Bootloader programs are necessary to load an OS into execution or to display a boot menu where the user can make a choice from the available operating systems installed on the PC. Loading an OS involves two important sectors* of the disk - master boot record (MBR) and the boot sector of the OS. The MBR contains a partition table and some executable code called master boot code (MBC). The partition table contains geometry information about the disk so that all the partitions on it can be identified. The MBC is written by OS installation procedures or a bootloader programs so that they will load the OS or the bootloader program respectively. The MBR is always on the first sector of a disk. The partition table on the MBR is written the first time a partition is created on a hard disk and is independent of the OS(s) installed on the computer. The boot sector is on the first sector of every partition on a disk. On an active partition, the boot sector contains code that will load the default OS or the bootloader program. On other partitions, the boot sector may or may not have executable code. On boot partitions, however, the boot sector has executable code necessary to load the operating system. When you partition a disc, the partitioning utility or the OS installation procedure will allow you designate one of the partitions as an active partition. Without an active partition, you will not be able to boot into an OS from the hard disc.

The sequence of loading an OS is as follows:

  1. When the PC starts, the BIOS locates the MBR on the disc, loads the MBC on the MBR, and transfers control to it.
  2. The MBC reads the partition table and identifies the active partition on the disk.
  3. The MBC loads the executable code in the boot sector of the active partition and transfers control to it.
  4. The executable code from the boot sector,
    • which if it belongs to default OS, loads the default OS.
    • which if it belongs to a bootloader program, loads the bootloader program.
  5. The bootloader program displays the boot menu and allows the user to select an OS.
  6. The bootloader program loads the boot sector on the boot partition of the selected OS.
  7. The code in the boot sector loads the OS.

Dual-Booting or Multi-Booting Windows

When you install Windows 2000/XP on a machine that already has Windows 95/98/Me, you have the option of upgrading (overwriting the Windows 9x/Me installation with Windows 2000/XP) or having a dual-boot or multi-boot setup. If you choose the latter, the new OS is installed on a different partition. The installation procedure installs a boot loader program in the boot sector of the active partition. It also modifies the MBC so that the latter can load the bootloader program that was installed on the Windows boot partition. The bootloader program displays a boot menu, which lists the available Windows OSs and lets the user to choose an OS from the menu.

The Windows 2000/XP installation procedure makes a copy of the original boot sector that was created by the Windows 9x/Me installation and places it in a hidden file named bootsect.dos. Next, it overwrites the boot sector with its own boot loader program NTLDR (NT Loader). So, every time you start the computer, NTLDR is loaded by the MBC. The NTLDR displays a boot menu that offers booting to Windows 9x/Me or Windows 2000/XP. If you choose the Windows 9x/Me option, then the old boot sector information from the bootsect.dos file is emulated by NTLDR and the computer boots into Windows 9x/Me.

NTLDR boot menu when you have installed only Windows operating systems - Windows Me and Windows XP


During the installation procedure, a file called boot.ini is created, which contains the choices displayed in the NTLDR boot menu. A typical boot.ini file on a PC that has Windows Me on the active partition (C:) and Windows XP on the second partition (D:) looks like this:

[Boot Loader]

[Operating Systems]
C:\="Microsoft Windows Me"
multi(0)disk(0)rdisk(0)partition(2)\WINNT="Microsoft Windows XP" /fastdetect

In the Boot Loader section, the Timeout parameter represents the number of seconds the boot menu will be displayed. If no option is chosen, the operating system specified by the Default parameter is loaded. In the Operating Systems section, NT-based OS installations are identified by Advanced RISC Computing (ARC)-style pathnames.

Advanced RISC Computing (ARC) Pathname Parameters
multi 0 Number of the disk controller identified by INT 13 (a CPU instruction used by BIOS) Because most BIOSes can identify only one adapter with INT 13, this number is always 0.
disk 0 SCSI ID of the disk This is valid only on SCSI controllers. For IDE discs, this number is always 0.
rdisk 0 Number of the disk on the controller On IDE controllers, the maximum number of disks possible is 4. So, this number ranges from 0 to 3.
partition 1 Number of the boot partition on the disk The boot partition is where the OS is stored. This is different from the active partition. In the above example, the active partition is C: but the boot partition for the Windows XP installation is the second partition or D:.

Linux Installation

You have learned how Windows OSs coexist. The real headache comes when you try to install a non-Windows OS like Linux. NTLDR recognises only Windows partitions (FAT, FAT-32 and NTFS) and is blind to Linux partitions. In other words, NTLDR cannot load Linux. Thankfully, Linux distros come with bootloader programs, such as GRUB (Grand Unified Bootloader) or LILO (Linux Loader), which recognise both Linux and Windows partitions. This means that they can load both Linux and Windows. When you install Linux, the installation procedure replaces the MBC (on the MBR) created for Windows NTLDR with an MBC that is set to load LILO or GRUB. (This means that, after the Linux installation, the user will see LILO or GRUB first instead of Windows or Windows NTLDR everytime the PC is started. This is a scary scenario for new Linux users. If they remove Linux somehow, they are uanble to boot into Windows.) When the Linux installation procedure installs LILO, it automatically creates an option for Windows in its boot menu. This allows the user choose to load Windows at the LILO/GRUB boot menu. When the user chooses the Windows option, LILO loads NTLDR and exits. NTLDR then displays its boot menu and allows the user to load a Windows OS.

Now, you should learn about the Linux installation procedure in more detail. The Linux installation procedure uses some special terms to identify hard disc partitions. The MBR is called /dev/hda. Your first partition is treated as /dev/hda1; the second one will be /dev/hda2, and it goes on like that. On a second hard disk on your PC, the partitions will be known as /dev/hdb1, /dev/hdb2,... On a third hard disk, we will have /dev/hdc1, /dev/hdc2... Every Linux installation requires two or three new partitions, which are identified as:

Manual partitioning and mounting of partitions during Linux installation.
A Linux installer asking where to install bootloader program

Here, I've got to make a small clarification. The Linux installation procedure will ask you for a location to install the bootloader (LILO or GRUB)? No mater which option you choose, the bootloader files are going to be stored on / or /boot. (None of the locations listed by the procedure is big enough to hold all the files of the bootloader program.)

UPDATE (2 July 2008): On a laptop, you do not have a floppy drive. Of late, Linux installers do not give informative options, such as the one above, limited though they are. Instead, its lists all possible locations where the bootloader can be installed.

A newer Linux installer asking where to install the bootloader program.

In the above screenshot, the first location (/dev/sda) is the MBR of my hard disk. The second location (/dev/sdb) was the MBR of the temporary RAM drive where the Mandriva 2008 Live CD system was running. (Live CDs create a temporary drive in the system memory (RAM) and temporarily run from there.) The third location (/dev/sda10) is where I installed / (root). The fourth location (dev/sda11) is where I installed /boot (boot partition). So, I asked the bootloader to install on the fourth device.

Getting NTLDR to Load Linux

You have learned how the default Linux installation handles multibooting. Basically, you have LILO loading NTLDR to boot into Windows. However, this involves overwriting the MBR i.e., the MBC (created for Windows NTLDR) being overwritten by an MBC (created for Linux LILO). If you are a Linux newbie, you might feel very apprehensive about this. What if you don't like Linux and want to get rid of it? LILO will be gone and there would be no way to boot into Windows! (Well, you could simply restart the PC with a DOS emergency disk and use the fdisk /mbr DOS command to restore the old Windows MBR.)

Now, if there was a way to get NTLDR into loading Linux, wouldn't you like that? Actually, a way exists. Interestingly, this idea was proposed by Microsoft. What you need to do is create a Linux boot sector file and place it in a Windows drive where NTLDR can access it. Next, you add a new entry in the boot.ini file so that NTLDR can use the bootsector file to transfer control to the Linux bootloader. (This is similar to the behind-the-scenes bootsect.dos-file technique that NTLDR uses to load Windows 95/98/Me.) This way, your Windows installations remains available all the time. Here are the steps:

  1. Power on/restart your PC.
  2. Enter BIOS setup. (Refer your motherboard manual for the exact key to press for entering BIOS setup. Usual suspects are Delete and F1.) Set your floppy drive as the first boot device, followed by your CD/DVD drive as the second boot device, and exit BIOS setup.
  3. Put your Linux install CD/DVD in the CD drive and restart your PC. (Remove any floppy discs from your floppy drives.)
  4. Your PC will boot from your CD and the Linux installation will begin. Follow the instructions on the screen but ensure that you have chosen the custom installation method so that you can manually specify all the options. (If you let the installation run on its own, it will overwrite the MBR with the Linux bootloader. We don't want that to happen so...) Create root (/), boot (/boot), and swap partitions as mentioned above. If you have already created these partitions in a previous installation, then just assign them. Ensure that you install the bootloader (GRUB or LILO) to /boot and not to the MBR. In Mandriva 2007 installation, you do this in the Bootloader step. (Please note that the following screenshot is newer - of Mandriva 2007 - while the rest of this article is based on Mandrake 10.1)
    Install the bootloader program to your /boot partition in the Bootloader step. Then in the Summary step, install it to a floppy disk and then back to the original /boot partition.
  5. Before exiting the Linux installation process, install the bootloader to a floppy also. (This is very important. As of now, your PC can boot into Windows only. To boot into your new installation of Linux for the first time, you will need this floppy disc.) After installing the booloader to the floppy, set the bootloader program back to your /boot partition. In the Mandriva 2007 Linux installation, you can do all this in the Summary step.
  6. When the installation is over, your PC will be restarted. Insert the floppy disc in the floppy drive and remove the Linux CD/DVD from the CD drive.
  7. You will now boot into your new Linux OS.
  8. Login as root (su).
  9. Use the dd console command to create a copy of the boot sector (first 512 bytes) of the Linux boot partition (/dev/hdc11) to a file (mlnxboot.dos) on the /dev/hdc1. The /dev/hdc1 partition (our Windows C: drive) should have been mounted and made writable for this command to work. I have named the Linux bootsector file as mlnxboot.dos because I am using Mandrake Linux 10.1. (BTW, Mandrake is now known as Mandriva.) You can use any name for this file. Just make sure the filename is in the DOS 8.3 format - maximum 8 characters for the filename and 3 characters for the extension. if stands for input file. of stands for output file. bs stands for block size. count stands for number of blocks to copy.
    dd if=/dev/hdc11 bs=512 count=1 of=/dev/hdc1/mlnxboot.dos
  10. Remove the floppy from the drive and restart the machine to boot into Windows.
  11. Open a command prompt window (type cmd or command in the Start menu Run dialog box), navigate to c:\
    cd c:\
  12. Use the DOS attrib command to make the boot.ini file writable.
    attrib -r -h -s boot.ini
  13. Open the boot.ini file in Notepad¤ and add this line to Operating Systems section.
    C:\mlnxboot.dos="Mandrake Linux 10.1"
    Now, my boot.ini file looks like this.
    [Boot Loader]
    [Operating Systems]
    C:\="Microsoft Windows Me"
    multi(0)disk(0)rdisk(0)partition(2)\WINNT="Microsoft Windows XP"
    C:\mlnxboot.dos="Mandrake Linux 10.1"
  14. Save the changes to the boot.ini file and restore the file's original attributes with the attrib command in the command prompt window.
    attrib +r +h +s boot.ini
  15. Restart the machine and the NTLDR will now display Mandrake Linux 10.1* in its boot menu. You can select the Mandrake option to boot into Linux. Sometimes, you may get an error message that says the <Windows root>\system32\hal.dll file is missing or corrupt. To avoid the hal.dll error message, ensure the boot sector file is named with the 8.3 format. Also, you need to make a new bootsector file everytime you make a change to your boot loader configuration. If you ever forget to do this, you can use the boot floppy you had created during the installation. Windows NTLDR boot menu with the new option for loading Mandriva
  16. If all your operating systems are dualbooting or multibooting fine, then enter BIOS Setup and set your hard disk as the first boot device. Otherwise, the BIOS will make your PC check for boot floppies or boot CD drives everytime it boots up. (Wastes time.)

With this setup, dumping Linux and going back to a monogamous relationship with Microsoft involves very little heartburn. Just delete the Linux partitions and remove the C:\mlnxboot.dos="Mandrake Linux 10.1" line from the boot.ini file.

Update - 15 June 2008: Recently, I bought an Acer Aspire 4520 laptop. I had been planning on installing Mandriva 2008 One on the laptop but a visitor pre-empted me with this message:

can u suggest me how to implement multiboot scheme on laptop where there is no floppy drive on to which i can install the bootloader.

Here is my reply to the visitor:

Yesterday, I installed Mandriva on my laptop. Without asking my permission, it went ahead and installed the bootloader program Grub on the MBR. After the installation, the laptop would boot first from from GRUB, rather than NTLDR. So, I booted the laptop with a Windows XP CD. It gave me an option of installing Windows XP or go into Recovery Console to repair an existing installation. I chose the latter. After entering my Administrator password, I used the command FIXMBR to restore NTLDR back on to the MBR. Next, I downloaded a freeware console program called Bootpart. I extracted the contents of the download file to a folder, I opened command prompt (Click Start menu, select Run option, type cmd (or command in Windows 2000) and press Enter key.) Using the CD command, I set the current folder to the folder where I had extracted the contents of the download file. Next, I gave the command bootpart. It listed all partitions, gave a number for each partition and listed the partition size for each. (It is easy to identify the Linux boot partition if you know where it appears in the order of partitions or if you know its approximate size.) Next, I typed the command bootpart my_inux_boot_partition_number mandriva.lnx, where I susbsituted my_linux_boot_partition_number with the number of my linux boot partition, as listed by the bootpart command I had given earlier. This created a bootsector file named mandriva.lnx. I copied this file to the same folder where my boot.ini file was kept. Next, I added a line for the bootsector file in the boot.ini file. I could then boot Mandriva linux directly from NTLDR.

So, what should you do? Let the Linux installer overwrite the MBR. Yes, let it. After the installation, when LILO or GRUB asks you, boot to Linux to create the bootsector file. Copy the file to the C: drive or your Windows drive. Restart and ask LILO to boot to Windows. Add the bootsector file to boot.ini file. Also, ensure that Windows is the default option if you need to work in Windows more than Linux. Restart again and go to Windows Recovery Console and restore NTLDR to MBR. This last paragraph summarizes the simplest and hassle-free way to dualboot between Windows and Linux.