As we said earlier, when you run Windows NT, its boot loader expects to be the one in charge; therefore, the normal way to dual boot Windows NT and Linux is to add Linux as an option on the NT boot menu. The information in this section also applies to Windows 2000, which uses the NT loader.
To accomplish this, you need to provide the NT loader with a copy of the Linux boot sector. Here’s how you do that on a computer running Windows NT with an NTFS filesystem (note that Windows NT should be installed on your system already). See the NT OS Loader+Linux mini-HOWTO for more information and other alternatives.
You should have a Linux boot floppy available so that, if necessary, you can boot Linux before the NT boot loader has been modified. You also should have a DOS-formatted floppy to transfer the boot sector to the Windows NT partition. If LILO is already installed, you may need to modify /etc/lilo.conf as described later. Otherwise, you’ll either install LILO as part of the Linux installation, or you can install it with the QuickInst script that comes with LILO. Once LILO is installed, and you have a configuration file, you can set up the system for dual booting.
Note that the following instructions assume your Linux partition is on /dev/hda2. If Linux is on another partition, be sure to replace /dev/hda2 in the following examples with the correct partition.
Specify the Linux root partition as your boot device. If you are editing /etc/lilo.conf manually, your entry will look like this:
boot=/dev/hda2
and will be the same as the root= entry.
Run the lilo command to install LILO on the Linux root partition.
At this point, if you need to reboot Linux, you’ll have to use the boot floppy, because the NT loader hasn’t been set up yet to boot Linux.
From Linux, run the dd command to make a copy of the Linux boot sector:
%
dd if=/dev/hda2 of=/bootsect.lnx bs=512 count=1
This command copies one block, with a blocksize of 512 bytes, from the input file /dev/hda2 to the output file /bootsect.lnx. (The output filename can be whatever makes sense to you; it doesn’t have to be bootsect.lnx.)
Copy bootsect.lnx to a DOS-formatted floppy disk:
%
mount -t msdos /dev/fd0 /mnt
%cp /bootsect.lnx /mnt
%umount /mnt
Reboot the system to Windows NT and copy the boot sector from the floppy disk to the hard disk. For example, using the command line to copy the file:
C:>
copy a:\bootsect.lnx c:\bootsect.lnx
It doesn’t matter where on the hard drive you put the file because you’ll tell the NT loader where to find it in step 8.
Modify the attributes of the file boot.ini [5] to remove the system and read-only attributes so you can edit it:
C:>
attrib -s -r c:\boot.ini
Edit boot.ini with a text editor to add the line:
C:\bootsect.lnx="Linux"
This line adds Linux to the boot menu and tells the Windows NT boot loader where to find the Linux boot sector. You can insert the line anywhere in the [operating systems] section of the file. Its position in the file determines where it will show up on the boot menu when you reboot your computer. Adding it at the end, for example, results in a boot.ini file that looks something like this (the second multi(0) entry is wrapped to fit in the margins of this page):
[boot loader] timeout=30 default=multi(0)disk(0)rdisk(0)partition(1)\WINNT [operating systems] multi(0)disk(0)rdisk(0)partition(1)\WINNT="Windows NT Server Version 4.00" multi(0)disk(0)rdisk(0)partition(1)\WINNT="Windows NT Server Version 4.00 [VGA mode]" /basevideo /sos C:\bootsect.lnx="Linux"
If you want Linux to be the default operating system, modify the
default=
line to say:default=C:\bootsect.lnx
Rerun attrib to restore the system and read-only attributes:
C:>
attrib +s +r c:\boot.ini
Now you can shut down Windows NT and reboot; NT will prompt you with a menu that looks something like this:
OS Loader V4.00 Please select the operating system to start: Windows NT Workstation Version 4.00 Windows NT Workstation Version 4.00 [VGA mode] Linux
Select Linux, and the NT loader reads the Linux boot sector and transfers control to LILO, on the Linux partition.
If you later modify /etc/lilo.conf or rebuild the kernel, you need to rerun the lilo command, create a new bootsect.lnx file, and replace the version of bootsect.lnx on the Windows NT partition with the new version. That is, you need to rerun steps 2-6.
Note
If you have any problems or you simply want to remove LILO later, you can reverse the installation procedure: boot to Windows NT, change the system and read-only attributes on boot.ini, reedit boot.ini to remove the Linux entry, save the file, restore the system and read-only attributes, and remove the Linux boot sector from the NT partition.
[5] boot.ini is the Windows NT counterpart to /etc/lilo.conf. It defines what operating systems the NT loader can boot.
Get Linux in a Nutshell, Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.