Dual-Booting-NT and Linux

Having more than one operating system on a single PC is useful for many reasons. Maybe you can't live without the exmh mailer on Linux, but you need the classic productivity suite in Windows NT. Or maybe you're a programmer, and you're porting a UNIX application to NT. Running both systems on one PC, although not as convenient as dedicating a machine to each system, can save the cost of an additional PC and the clutter of multiple hardware setups.

Setting up a PC to boot more than one operating system is not difficult. Many techniques and tools are available for dual-booting. Some are direct and simple; others invite confusion and inconvenience. Your choice of a dual-booting technique depends on which operating system you use most often, which system you are more comfortable with, and how you have structured your disk partitions. I think the techniques in this article are the best in most circumstances.

Remember two important, if familiar, pieces of advice. First, before you install a second OS, back up your current one. I've lost the contents of a hard disk only three or four times in three decades of intensive computer use, and one of those times occurred during an attempt to install multiple systems on a hard disk. Second, keep things simple. I've wasted hours trying to figure out why a slightly bizarre arrangement of boot files and partitions doesn't quite work. Just set up the systems in the simplest way you can, and go to the beach.

Booting Basics
When a PC boots, a small program in the computer's ROM tries to find and execute another small program on either a floppy or the first hard disk. This program in turn starts another program. Eventually, the programs load enough of the operating system so that it can begin its usual operation.

The small, simple ROM program that begins the boot process does not carry out a sophisticated search for the next program in the sequence, but follows a simple convention to find its target. If you have inserted a floppy into the drive, the boot code loads the first sector (i.e., the first 512-byte storage unit) of the floppy into memory and executes it. This boot sector continues the boot sequence. You can configure some computers to skip the initial check for a mounted floppy and boot from the hard disk.

In the absence of a floppy, the ROM boot code reads the first sector of the hard disk (or of the first hard disk if the system has more than one). This sector, the Master Boot Record (MBR), contains a small program that continues the boot process. The MBR also contains a partition table that describes how you configure the disk into one or more virtual disks, or partitions.

Partitions are useful in several ways. For example, NT and Linux support different native file systems; their methods for keeping track of files on disk are incompatible. To install both OSs on one machine, you need two disks. Partitions let you create two or more virtual disks on the same physical device. You can format each partition according to its operating system's file structure.

The conventional format of the MBR requires that the boot code and the partition table share the crowded confines of a 512-byte record. The limited size of the partition table restricts the number of partitions to four primary partitions per hard disk. (You can configure a primary partition as an extended partition, within which you can define another world of partitions. However, the added complexity of these partitions-inside-a-partition, or logical partitions, is such that you usually cannot boot them.) With NT on one partition and Linux on another, dual-booting comes down to how to conveniently boot from one partition or another.

Partition Configuration
The structure of partitions on a PC hard disk is usually not as neat as you would like. If you set up a system from scratch, you can allocate the disks between operating systems in some simple way: two primary partitions, for example. If you already run NT, you probably have a spare partition, maybe a logical partition, that you can clear and make available for Linux.

Problems in the original design of the PC can limit the possible partition configurations. Sometimes, the BIOS supports only the first two drives. Also, some BIOS code cannot read boot programs or data from cylinders above 1024. (Disks store information in cylinders, tracks, and sectors. Modern, large-capacity disks can have more cylinders than the original PC specification anticipated.) Fortunately, these two problems don't pertain to NT because of the way NT boots.

However, another problem does affect NT. Boot programs sometimes cannot handle disks larger than 4GB. BOOTPART (a small, downloadable freeware program that helps you add partitions--including Linux partitions--to the standard NT boot menu) has such a limitation.

The basic rule for setting up operating system partitions is to create (or use existing) low, primary partitions on the first hard drive. You can relax this rule, but at the expense of complications in setup and maintenance.

Boot Techniques
You can choose between two flexible, reliable dual-booting tools and techniques: BOOTPART (with the NT boot loader NTLDR) and the Linux Loader (LILO). Both work well, but if you're comfortable with NT, pick BOOTPART; if you're more familiar with Linux, pick LILO.


The basic rule for setting up OS partitions is to create low primary partitions on the first hard drive.

The BOOTPART program is simple in principle: It writes a 512-byte file containing a pseudo-boot sector that takes control from the standard NT boot loader, NTLDR, and in turn boots the target partition's boot sector. BOOTPART edits the NT boot.ini file to include a pointer to the new file and a boot menu item that you can choose as NT boots. If you are adding Linux to a primarily NT system (especially if you might remove Linux later), choose this dual-boot method. This method requires no changes to the MBR, and you need only one console command to remove the Linux option from the boot menu.

Setup. Install NT, if you haven't already installed it; then install Linux. Make sure that LILO resides in the boot record of the partition in which Linux resides; that is, the boot= and root= parameters of the /etc/lilo.conf file must refer to the same partition. Do not install LILO in the MBR: NT controls the MBR in this configuration. For easy and reliable installation, I recommend Red Hat Linux 4.0. Although Linux installation is never automatic, the Red Hat distribution comes close to that ideal. (The robust bootpart/ntldr/lilo booting chain functions properly even if the Linux kernel is in a logical partition.) The next step is to run the LILO map installer, /sbin/lilo, then reboot NT.

Next, install BOOTPART, if you haven't already installed it. A convenient place for BOOTPART is %systemroot%\winnt\system32. At the MS-DOS prompt, type


This routine produces a list of partitions on all available disks.

Find the Linux-type partition on which you've installed Linux, and note its number within the BOOTPART list. If the Linux partition is 3, for example, type


This routine tells the system to create the file c:\linxboot.bin, which includes a chain loader that runs the boot sector of partition 3 (where LILO is ready to boot Linux). Also, the statement tells the system to add a choice named Linux to the NT boot menu (the c:\linxboot.bin file).

Reboot NT. The Linux choice should appear in the NT boot menu. Using the arrow keys, select Linux, and press Enter. Welcome to Linux.

If you use the Control Panel System applet, you can choose any operating system in the NT boot menu as the default system. And you can choose a timeout, after which the default system will boot in the absence of a specific user menu choice.

Removal. At the MS-DOS prompt, type


and make a note of the partition number of the Linux system partition. If the Linux partition is 3, type


The Linux partition is now free for other use.

LILO is designed specifically as a boot loader for Linux, but LILO also can chain load the boot sector of Microsoft systems. You can configure LILO to boot directly to a default system or to pause for user input, letting users choose among two or more operating systems at boot time.

If Linux will be your primary OS (and especially if you might remove NT later), use LILO as your basic system loader. LILO is hard to configure (its user's guide has more than 40 pages), but it permits flexible setups.

Setup. If you haven't already installed it, install Linux. Place the boot loader in the MBR, unless you have reason not to.

Next, install NT in a primary partition. LILO can boot a foreign system only from a primary (not a logical) partition. If the NT installation procedure complains about the current MBR, do not let it overwrite the MBR. Note the drive number and partition number of the NT system partition.

Reboot the system and start Linux. Add the following section at the end of the LILO configuration file (/etc/lilo. conf)

other=/dev/hda4 label=ms table=/dev/hda

where the other= field is the device name. The first IDE drive is hda, the second hdb, and so forth; the partitions are numbered from 1. So, the fourth partition on the first IDE drive is /dev/hda4. The label= field contains the letters you choose to type at boot-time to boot NT. The table= parameter is redundant; set it to the same value as the device, but delete the partition number.

If you want to adjust the time that LILO waits for user input before the default system boots, find and edit the value of the timeout= parameter. The value's units are tenths of seconds, so enter 100 to delay 10 seconds before booting the default. /etc/lilo.conf mentions the default system first; to set a new default, move the entire system's section so that it appears before the current default. Run /sbin/lilo to effect the changes you've made to /etc/lilo.conf.

Removal. Edit /etc/lilo.conf and remove the NT section described above or comment out (with #) the section. Run/sbin/lilo to effect the changes you've made to /etc/lilo.conf. The NT partition is now free for other use.

Ready to Roll
Whether your primary system is Linux or NT, these tips present a straightforward way to install both systems on one PC. For more information about NT booting, see the Microsoft Knowledge Base article number Q101787. You can find BOOTPART 2.0 at http://ourworld.compuserve.com/homepages/gvollant/bootpart.htm. You can obtain a complete description of LILO in all Linux distributions or at ftp://sunsite.unc.edu/pub/Linux/system/Linux-boot.

TAGS: Windows 8
Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.