III.  Boot managers


III.2  NT Loader and boot.ini file

NT boot process

Windows NT system may be booted only from a primary partition or a floppy disk, however NT operating system files may be stored on either, a primary partition, or a logical volume. It does not modify Master Boot Code stored in the MBR of the boot disk, and uses standard BIOS method for loading Volume Boot Sector. Itself, Windows NT, does not require its primary partition to be active, however, when default Master Boot Code is used, that partition must be active to boot. This property of NT may be used only with other boot managers, such as Solaris boot manager, Linux Loader or OS-BS FreeBSD boot manager.

Allowed file systems on the NT primary partition are FAT-16 and NTFS for NT 4.0, additionally FAT-32 for W2K. The following files are used in the early phase of Windows NT boot process:

  1. ntldr,
  2. ntdetect.com,
  3. boot.ini,
  4. (optionally) ntbootdd.sys.

All those files are placed on the root of the boot partition, not necessarily the same partition, where NT operating system files reside. In particular they may be placed on a boot floppy disk. The last file on the list: ntbootdd.sys is optional and absent in most cases. File ntldr contains the main boot program. In opposite to msdos.sys - MS DOS boot program - ntldr need not to reside at the first sectors of the boot partition, and may be copied without the use of special methods. This applies also to all previously listed files.

NT Loader allows to load not only Windows NT, but almost all operating systems for IBM PC compatibles. To load other than Windows NT operating system, a file containing the VBS or Master Boot Record specific for that operating system is required. When it is the VBS or MBR depends on the behavior of the operating system and is explained in the latter section. User chooses operating systems from a text menu displayed by NT Loader. The NT boot process, including the menu for operating systems, may be configured within NT Loader's configuration file: boot.ini.

boot.ini file

boot.ini file contains configuration of the NT boot process. It is a regular Windows INI file, that is, it consists of sections which in turn contain variables we can assign values to. Its read-only flag is on by default, so you may need to switch it off before editing. Only part of options of that configuration file will be discussed in this document. For further details see [MS1] or [Russinovich]. An example of boot.ini file:

[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(1)partition(1)\WINNT

[operating systems]
multi(0)disk(0)rdisk(1)partition(1)\WINNT="MS Windows NT 4.0"
multi(0)disk(0)rdisk(1)partition(1)\WINNT="MS Windows NT 4.0 [VGA mode]" /basevideo /sos
C:\solaris.bin="Sun Solaris" 
C:\dos.bin="MS DOS 6.22" 
C:\floppy.bin="Boot floppy A:"

It is usually divided into two sections boot loader and operating systems. The meaning of variables of the first one is as follows:

default
Specifies the default operating system that will be loaded if a user does not make any choice in NT Loader menu.
timeout
Specifies time in seconds, to wait before default operating system is loaded.

Entries in the section operating systems, according to its name, configure NT Loader to boot operating systems and define NT Loader menu items. Each entry in this section is of the form:


location = menu-item { option }


where

location
Specifies the location of either, NT System Root, or the file containing the boot code of other then NT operating system. Accordingly, two different syntaxes are used, which we explain further.
menu-item
Text displayed in the NT Loader menu.
option
A switch that controls NT boot process (cf. [Russinovich]). It is possible to specify either none, one, or more switches in one entry. Commonly used are:
basevideo
Standard VGA display driver is used in GUI mode
sos
Print information about what drivers are being loaded as the system boots.
win95
Emulate the boot process of Windows 9x and load Windows 9x.
win95dos
Emulate the boot process of Windows 9x and load DOS.

Only 8 items may be displayed in the NT Loader menu, so only the first 8 entries will be available on this menu.

Booting NT

To boot Windows NT, an entry in the section Operating Systems of boot.ini file must contain location which specify the location of NT System Root. NT System Root is a directory where the files of Windows NT operating system reside. The NT environment variable %SystemRoot% points to that directory. NT operating system may be stored on a primary partition, as well as on a logical volume. When pointing to NT System Root the syntax for location is as follows:


( multi( X ) | scsi( X ) ) disk( Y ) rdisk( Z ) partition( W ) win-nt-dir


Parameter multi is valid for both IDE and SCSI hard disk drives, and indicates to Windows NT that it should rely on the computer's BIOS to boot the system. This means that the NT Loader will be using interrupt Int 13h calls to find and load the kernel of the system and any other files needed to boot Windows NT. In this case the X, Y, Z, and W parameters have the following meaning:

When multi is used the following limitations apply:

  1. In a pure IDE/ATA system, NT Loader may boot the system from one of up to four hard disk drives connected to the first dual-channel controller.
  2. In a pure SCSI system, NT Loader may boot the system form the first two drives on the first SCSI controller, that is, the controller whose BIOS loads first.
  3. In a mixed SCSI and IDE system, NT Loader may boot the system only from IDE/ATA drives on the first controller.

Parameter scsi indicates that NT Loader will load a boot device driver and use that driver to access the boot partition. The device driver used is in the file ntbootdd.sys, which is a copy of the device driver for the drive controller in use. In this case the X, Y, Z, and W parameters have the following meaning:

To determine the value of the X parameter, in case of multiple adapters that use different device drivers, only those adapters should be counted which are controlled by ntbootdd.sys. In that situation, to boot Windows NT from a hard disk on the adapter not controlled by ntbootdd.sys, the file ntbootdd.sys should be changed for the copy of appropriate device driver (cf. [MS1]).

Summarizing, the part of the location string to the backslash specifies the controller, the hard disk drive and the partition, where NT operating system files are kept. Hence, the rest of that string - win-nt-dir - is always the path to the NT System Root directory with the drive letter (and colon) truncated. Usually it is WINNT.

Booting other than NT operating system

To boot other than NT operating system, location of the entry in boot.ini file must specify the file containing the boot code of that operating system.

As we mentioned earlier, the boot code of other than NT operating system is its MBR or VBS. Generally, if the operating system uses its own specific code in the MBR, in other words if it overwrites during installation the Master Boot Code, not only the Master Boot Table, the boot code is its MBR. Otherwise, the boot code is the VBS of the boot partition of that operating system. The boot code for DOS, Windows 3.x and Windows 9x is in suitable VBS, for Solaris it may be either in Solaris MBR or VBS, for Linux it is there, where LILO was installed.

The boot code must be stored in a plain binary file. There is are quite many programs, either free or commercial, to manipulate MBRs and VBSes. The free program Boot reads MBR or VBS from a hard disk drive and stores its image in a 512 byte long file. The also performs reverse operation, that is, restores the MBR or VBS from a file. It is useful for backup purposes. Another freely available program [BootPart] creates special boot block files that may reboot any primary partition on any hard disk drive on a machine, even a floppy disk. It also automates editing boot.ini file, restores the VBS of the DOS, Windows 9x and NT boot partitions.

The boot code image files should be placed in the root of the boot partition, where ntldr and boot.ini are placed. Note that it need not to be a NT partition, but any primary FAT-16, FAT-32 in case of W2K, or NTFS partition. The syntax for location in this case is as follows:


c:\ | c:\ file-name


file-name is the file name of the boot code image file. It may be omitted when booting MS DOS, the boot code is stored in the standard file bootsect.dos, and there is no Windows 9x installed in the boot partition.

There is a serious limitation when using images of MBR or VBS. Only those operating systems may be booted this way, which boot partitions reside on the boot drive. It is imposed by the BIOS not NT Loader. There is no problem if we have a single hard disk drive. Problems arise when we want NT Loader to boot off the second drive. Say that the primary master IDE drive (C: in BIOS boot sequence) is a boot drive, and we want to boot with NT Loader an operating system which boot partition is placed on the secondary master drive (D: in BIOS lettering). VBS of that partition or MBR of the later drive is useless as it assumes the operating system is on the boot drive and reads from that one. The workaround is to use BootPart program. It does not simply make images of VBSes or MBRs but creates its own, special boot code which switches the boot drive on the fly if it is necessary. If we use BootPart in our example, the boot process could look as follows: NT Loader first loads a boot block created by BootPart, it then switches the boot drive to D:, loads appropriate VBS of boot partition and the boot process of the operating system begins.

Repair NT boot sector

When NT shares its boot partition with other operating system, e.g. Win9x, NT boot sector may be overwritten with fdisk or similar tool. This usually leads to problems with booting NT, at best, you can still boot Win9x. This is because NT boot sector contains its own specific code to load ntldr responsible of booting NT.

To repair NT boot sector, use either, BootPart, or NT installation software. In case of BootPart, boot to plain DOS and invoke:


bootpart


to see the list of all partitions in the system. Determine the drive letter of the partition which boot sector should be fixed. Note that BootPart shows C:, D: for disks, like BIOS does, not for volumes. For the first partition on the list, i.e. C:, type:


bootpart winnt boot:c:


Make sure the partition is active. The other method runs as follows:

  1. boot NT installation floppies or CD,
  2. choose repair damaged installation when prompted,
  3. configure device drivers appropriately, and,
  4. select "Inspect boot sector" only.