Paul Komski
03-21-2007, 04:47 PM
Over three years ago I posted a thread http://pcguide.com/vb/showthread.php?t=22390 which mjc then assigned "temporarily" as a sticky. It is out of date now and the concepts involved are better understood now than at that time, when I used an empirical approach to generally get windows back to where it was wanted. I have thus unstuck the original and made this into a new sticky outlining some of the basics behind how boot.ini integrates itself with the partition tables and how its references can "misbehave". If the concepts are understood it is much easier to troubleshoot and make corrections.
The boot.ini file should be found in the root of the system partition and is what (in conjunction with the ntldr file) directs the boot processes to a relevant windows installation. Leaving Vista aside, this relates to the three NT-based OSes WinNT/2000/XP. Malconfiguration of the boot.ini file commonly leads to messages such as hal.dll or ntoskernel or ntldr "is missing or corrupt" or similar messages, when misleadingly these files may well be neither missing nor corrupt but rather that boot.ini is either absent or is misdirecting the boot processes so that these files are not found.
In MS parlance, the system partition is the partition that windows is booted FROM and the boot partition is the partition that is booted TO. On a single partition system they are one and the same. The system partition will, almost without exception have the drive letter C: and should have been marked as active in the partition tables of that hard drive. The boot partition contains a "Windows system folder" usually called WinNT under WinNT/2000 and Windows under WinXP. If this boot partition is on a different partition from the system partition then the boot partition will not have the C: drive-letter.
All that follows relates only to IDE/ATA drives and not to SCSI drives to which there are differences.
A typical entry in boot.ini would be:-
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect /NoExecute=OptIn
This could be simplified to multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="" and the system would still boot OK. The important values are the rdisk number, the partition number and the name of the System Folder. What goes inside the "" (quotation marks) is what should show-up in any boot menu made visible during start-up; this particular value has no effect on the boot process. The hard drives in a system are enumerated in boot.ini starting with rdisk(0) then rdisk(1) etc. The partitions in a hard drive are enumerated in boot.ini starting with partition(1). This is when understanding the linkage to the partition tables is essential if you want to really understand which partition boot.ini is referring-to and attempting to boot.
First off, there are four partition tables in a basic HDD's partition tables. A boot.ini reference to partition(1) DOES NOT REFER DIRECTLY TO the first physical partition on a drive. It does however refer to the first primary (non-extended) partition referenced in the partition tables. It is not generally understood that the partition tables themselves (1 to 4) do not refer, sequentially, to four physical primary partitions as outlined sequentially on a hard drive. That is to say that one could have four physical partitions on a hard drive but partition table 1 could refer to any of them. The tables do not have to be in order. Let us say that there are four primary partitions on a particular hard drive and that the second of these is a combined Windows boot and system partition marked as active. The system will attempt to boot this partition but if the boot.ini file on that partition does not correctly identify itself its own ntldr will not be found. One might expect the boot.ini reference, in that specific instance, to be unequivocally partition(2) but that is not necessarily the case!!! It is only the case if the first two partition tables refer to primary (non-extended) partitions and the second partition table then refers to a windows system partition residing on the second physical partition. It is partition(2) because it is the second partition table entry and not because it is the second partition on the drive. If the boot.ini file was edited to partition(1) the system would not boot up UNLESS the partition tables 1 and 2 were swapped around. If this was done then boot.ini's partition(1) reference would refer to the first partition table, which would refer, correctly, to the second physical partition and the system would still boot OK.
I hope this is making sense, even though it is a hard concept for most to grasp. The basic rules are that as far as boot.ini is concerned an extended partition is totally ignored. Partitions (1) thru (4) (or thru (3) if there is an extended partition) refer to the four (or three) primary partition tables. Logical partitions follow after all primary non-extended partitons have been enumerated. Thus if there is only one primary partition and two logical partitions the logicals will be partition(2) and partition(3) but if there are three primary partitions the first two logical partition will be partition(4) and partition(5) - and this is the case even if those two logicals are right at the start of the hard drive and regardless of which partition table references the extended partition that is holding them.
Once this makes sense one can usually edit boot.ini (or sometimes edit the partition tables equivalently) in order to get its references correct and the system to boot up again.
If boot.ini is on a FAT partition then one can edit it easily from an msdos floppy startup diskette or similar. If boot.ini is on an NTFS partiton then one needs to be able to access it some other way or to boot into windows and correct things once inside windows. A special floppy diskette containing an NT partition boot sector and the three files boot.ini, ntldr and ntdetect.com is capable of booting up windows without using the hard drive for the boot-up routine. One can make one oneself by formatting a floppy FROM Win2K/XP and then copying the three mandatory files onto it. Bootdisk.com keep an image file of the same sort of floppy called an XP Quick Boot Diskette from http://bootdisk.com/bootdisk.htm and the same floppy can be made from an EBCD from http://ebcd.pcministry.com/download_en.html
Boot.ini on NTFS can also be edited using EditBini from http://www.terabyteunlimited.com/utilities.html and placed on an msdos boot floppy or run from a DOS based version of Windows such as Win9x or by BiNG (BootIt-NG) from http://www.terabyteunlimited.com/bootitng.html One edits any file from BiNG by choosing a partition's properties entry and then the edit button. One can additionally use BiNG to edit or move the partition tables on the MBR around.
Finally, boot.ini in WinXP can be rebuilt by booting to the Recovery Conole on the installation CD and running bootcfg /rebuild
The boot.ini file should be found in the root of the system partition and is what (in conjunction with the ntldr file) directs the boot processes to a relevant windows installation. Leaving Vista aside, this relates to the three NT-based OSes WinNT/2000/XP. Malconfiguration of the boot.ini file commonly leads to messages such as hal.dll or ntoskernel or ntldr "is missing or corrupt" or similar messages, when misleadingly these files may well be neither missing nor corrupt but rather that boot.ini is either absent or is misdirecting the boot processes so that these files are not found.
In MS parlance, the system partition is the partition that windows is booted FROM and the boot partition is the partition that is booted TO. On a single partition system they are one and the same. The system partition will, almost without exception have the drive letter C: and should have been marked as active in the partition tables of that hard drive. The boot partition contains a "Windows system folder" usually called WinNT under WinNT/2000 and Windows under WinXP. If this boot partition is on a different partition from the system partition then the boot partition will not have the C: drive-letter.
All that follows relates only to IDE/ATA drives and not to SCSI drives to which there are differences.
A typical entry in boot.ini would be:-
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect /NoExecute=OptIn
This could be simplified to multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="" and the system would still boot OK. The important values are the rdisk number, the partition number and the name of the System Folder. What goes inside the "" (quotation marks) is what should show-up in any boot menu made visible during start-up; this particular value has no effect on the boot process. The hard drives in a system are enumerated in boot.ini starting with rdisk(0) then rdisk(1) etc. The partitions in a hard drive are enumerated in boot.ini starting with partition(1). This is when understanding the linkage to the partition tables is essential if you want to really understand which partition boot.ini is referring-to and attempting to boot.
First off, there are four partition tables in a basic HDD's partition tables. A boot.ini reference to partition(1) DOES NOT REFER DIRECTLY TO the first physical partition on a drive. It does however refer to the first primary (non-extended) partition referenced in the partition tables. It is not generally understood that the partition tables themselves (1 to 4) do not refer, sequentially, to four physical primary partitions as outlined sequentially on a hard drive. That is to say that one could have four physical partitions on a hard drive but partition table 1 could refer to any of them. The tables do not have to be in order. Let us say that there are four primary partitions on a particular hard drive and that the second of these is a combined Windows boot and system partition marked as active. The system will attempt to boot this partition but if the boot.ini file on that partition does not correctly identify itself its own ntldr will not be found. One might expect the boot.ini reference, in that specific instance, to be unequivocally partition(2) but that is not necessarily the case!!! It is only the case if the first two partition tables refer to primary (non-extended) partitions and the second partition table then refers to a windows system partition residing on the second physical partition. It is partition(2) because it is the second partition table entry and not because it is the second partition on the drive. If the boot.ini file was edited to partition(1) the system would not boot up UNLESS the partition tables 1 and 2 were swapped around. If this was done then boot.ini's partition(1) reference would refer to the first partition table, which would refer, correctly, to the second physical partition and the system would still boot OK.
I hope this is making sense, even though it is a hard concept for most to grasp. The basic rules are that as far as boot.ini is concerned an extended partition is totally ignored. Partitions (1) thru (4) (or thru (3) if there is an extended partition) refer to the four (or three) primary partition tables. Logical partitions follow after all primary non-extended partitons have been enumerated. Thus if there is only one primary partition and two logical partitions the logicals will be partition(2) and partition(3) but if there are three primary partitions the first two logical partition will be partition(4) and partition(5) - and this is the case even if those two logicals are right at the start of the hard drive and regardless of which partition table references the extended partition that is holding them.
Once this makes sense one can usually edit boot.ini (or sometimes edit the partition tables equivalently) in order to get its references correct and the system to boot up again.
If boot.ini is on a FAT partition then one can edit it easily from an msdos floppy startup diskette or similar. If boot.ini is on an NTFS partiton then one needs to be able to access it some other way or to boot into windows and correct things once inside windows. A special floppy diskette containing an NT partition boot sector and the three files boot.ini, ntldr and ntdetect.com is capable of booting up windows without using the hard drive for the boot-up routine. One can make one oneself by formatting a floppy FROM Win2K/XP and then copying the three mandatory files onto it. Bootdisk.com keep an image file of the same sort of floppy called an XP Quick Boot Diskette from http://bootdisk.com/bootdisk.htm and the same floppy can be made from an EBCD from http://ebcd.pcministry.com/download_en.html
Boot.ini on NTFS can also be edited using EditBini from http://www.terabyteunlimited.com/utilities.html and placed on an msdos boot floppy or run from a DOS based version of Windows such as Win9x or by BiNG (BootIt-NG) from http://www.terabyteunlimited.com/bootitng.html One edits any file from BiNG by choosing a partition's properties entry and then the edit button. One can additionally use BiNG to edit or move the partition tables on the MBR around.
Finally, boot.ini in WinXP can be rebuilt by booting to the Recovery Conole on the installation CD and running bootcfg /rebuild