Dual Booting

What is dual booting and why would you want to do it?

Dual booting is simply the ability to have two operating systems on your PC at the same time. When your PC boots, you have the option of choosing what OS to boot to. What do I mean by operating system? This includes MS-DOS, Windows 95, Windows 98, NT, 2000, XP, Linux, and so on.

In fact, if you wanted to, you could have many operating systems on your PC. You are not limited to the usual two implied by the term "dual-booting." For example, my machine currently boots to Windows 98SE, Windows XP and Linux.

But why would you want to have more than one operating system?

There are a number of possible reasons:

For me, all of these reasons are valid. But most important is the last one. I play a lot of old games which won't run under XP. I guess I'm just one of those people who believes that the classics are often the best! Tie Fighter, for example, is one of my favourite games. It will run under Windows 98, but not under XP.

XP is my main platform, with Linux coming up second. Windows 98 comes out occasionally, for testing applications or for playing old games.


What combinations of operating systems can I have?

Just about any combination you like. In this article I will initially explain how to install a Windows 98 / Windows XP dual boot environment, since that is what I use. That said, many of the principles and techniques are equally applicable to other operating system combinations. (I will cover dual booting with Linux a little later.)

There's one general guideline which makes a dual boot setup easy and smooth: always install the older operating system first. Although it is possible to install an older OS on top of a newer one, the process is often not quite as easy. Why make life hard for yourself? The reason for this rule is that the newer operating systems will recognise the boot sector of an older one and will generally give you the option of multi-boot environment. If you go the other way, the older OS will not recognise the newer boot sector and will happily overwrite it. This has the nasty effect of preventing you from getting to your existing operating system. Although the boot record can be repaired, there's no need to go down this road if you plan carefully.


How does a dual-boot system boot?

This is a little complicated and describing the process, unfortunately, involves some fairly confusing terms.

When you power on your PC, routines in the system's BIOS enable access to the master boot record (MBR). (Note the distinction between MBR and Boot Sector. In the old FAT16 days of DOS and Windows 95, the master boot record was also known as the "Boot Sector" since it only occupied one sector - 512 bytes. However, a FAT32 system partition, for example has a three sector boot record. Therefore the term boot sector should be used only when referring to the first sector of the boot record.) The MBR starts at the the first sector of the first hard disk found. It contains the partition table and master boot program (MBP). Because of this, the first partition of the first hard disk is also known as the system partition. The partition table indicates which partition is the current active partition. The MBP loads the boot record of this partition, which, in turn, loads the bootfiles of the system partition.

If you only have Windows 98, then the Win98 bootfiles are io.sys, msdos.sys, command.com and optionally config.sys and autoexec.bat. The MBP kicks off the OS by loading io.sys. This looks for config.sys in order to load any additional drivers. The OS then looks for msdos.sys which (unlike its role in the DOS days) is simply a text file for customising the startup process. This file contains a line indicating the location of the Windows 98 system files, i.e. critical files within the windows directory. Note that the drive these files live on is referred to as the boot partition. While the system partition and boot partition are usually one in the same in single OS systems, the term becomes more confusing when referring to dual boot systems. That's because the system partition is the one storing the bootfiles while the boot partition is the one containing the core OS files. On a dual boot system, these can be different, but remember that the first place the BIOS looks is on the system partition.

If you have only Windows XP (or 2000/NT), then the bootfiles are very different. They include ntldr, boot.ini and ntdetect.com. In this case, the MBP loads the bootstrap program ntldr. This kickstarts the NT/2000/XP OS and looks for boot.ini. This is a text file that stores startup options. The OS then runs ntdetect.com which initialises hardware and allows the process to continue. Finally, the core system files on the boot partition get loaded: ntoskrnl.exe and hal.dll, which reside in the %windir%\system32 directory.

If you have a dual-boot system, then you will have a combination of these bootfiles on your system partition, plus one or two more. Firstly, recall that the newer OS will install a new bootsector over the top of the old one. Fortunately, it is also clever enough to back up the older OS's boot sector in a file called bootsect.dos. When you boot such a system, the process starts like any other NT/2000/XP system. I.e. the MBP loads ntldr which in turn looks at boot.ini. In this case, however, boot.ini has entries pointing to both operating systems. If you choose the XP partition, then the NT boot process continues as normal. If, however, you choose the Windows 98 partition (or some other legacy operating system), then the boot sector stored in bootsect.dos is read and the machine essentially warm-reboots. The system reboots with the Windows 98 boot sector loaded into memory. This results in a normal Windows-98 style boot from this point onwards.


How to create a Windows 98 / Windows XP dual-boot environment

As already mentioned, installing Windows XP on to a Windows 98 system is easy because the new OS detects the existing OS boot sector and copies this into the system file bootsect.dos.

We will begin by assuming you have Windows 98 installed into the first partition of the first fixed disk, i.e. drive C:. If you're only running Windows 98, then this is a pretty fair assumption. Thus this partition is the system partition, but is also the boot partition for Windows 98.

Windows XP needs to be installed into a different partition/drive. If you do not have another partition available, then you will have to create one. Tools like Partition Magic are great for performing this sort of task, because they can do it without destroying existing data (unlike fdisk).

Let's say you have a second partition available and this is your drive D:. This will become the boot partition for your new Windows XP installation. Note that the system partition will not change (although a new boot sector will be written and new bootfiles will be added to this partition).

Now you're ready to add your Windows XP partition. Boot from the Windows XP installation CD and choose the Advanced setup option when given the opportunity. Choose to install XP as a new installation, not as an upgrade otherwise your existing Windows 98 operating system will be replaced. When asked where to install Windows XP, change the default setting (which will be drive C:) to point to your other partition (e.g. drive D:). For ease of maintenance, I would also change the default directory name of "windows" to something else, like "winXP". This makes it easy to see which OS you're working with.

That's pretty much it! The installation should now go on as usual. A boot.ini file will be created on the system partition (C:) which will have entries for your new XP installation, but also for your old OS. Thus you will prompted which OS to boot into when your system starts.

One warning: do not convert your system partition to NTFS. This is because Windows 98 does not support it, so you will render your old OS unusable. You can, however, convert your Windows XP boot partition (i.e. D:) to NTFS, if you wish.

Well, that's dual booting in a nutshell. As I already mentioned, the techniques described here can be applied to other operating systems. It just goes to show... this stuff really isn't that hard to do when you know how!


How to dual boot Windows and Linux

Linux distributions typically come with one of two bootloaders: GRUB or LILO. I won't go into the details of these, since I'm assuming most Linux users already know about them. Suffice-it to say that if you install any modern Linux distribution on top of a Windows installation, Linux will detect the presence of Windows and will give you the option to dual boot.

If you choose to install the Linux bootloader into your System Partition, then the first thing you'll see when you boot is your Linux bootloader. Your Windows operating system will be listed as an option on this bootloader. Should you choose "Windows" from this menu, you will boot into your Windows operating system. If your Windows operating system(s) already used a bootloader (such as XP, 2000 and NT), then this bootloader will function exactly as it did before.

So... A quick example: Let's say you've got a Windows 98 and XP dual boot environment. Currently, when you power-on, you'll see the Windows bootloader and can choose your Windows OS from there. If you now install Linux, the first thing you'll see when you boot is your Linux bootloader (LILO or GRUB). Various Linux options will be shown on this boot menu, as well as an option for Windows. If you choose Windows, you'll then be presented with your old Windows boot menu.

But if you, like me, use Windows more often than you use Linux, then you may wish to see your Windows boot menu first. This is easy to do: