PDA

View Full Version : disk enumeration


mrmomaz
11-11-2006, 12:13 PM
Can I rely on the BiNG Direct Boot display to give me the correct disk enumeration number? If not, then is there any way for me to find the disk number assigned to a HDD at boot time? <I'm using this number with my Boot.ini's.>

I can count the partition number, but the Boot.ini genereated by Recovery bootcfg/ rebuild has my confused.
thanks
Win xp/pro/sp2

kriptokool
11-11-2006, 04:41 PM
You can try viewing them with the disk manager under Administration tools in control panel

mrmomaz
11-11-2006, 08:10 PM
Thanks for the post. I use disk management often as it is a good tool. While this shows what partitions I have, what I'm interested in is the Enumeration Number that is assigned to each partition, be they primary or logical.

mrmomaz
11-12-2006, 12:07 PM
Having a clearer mind last night, I enumerated Primaries on a HDD first and then logicals, and by using Disk Managemet I could correctly determined all my Boot.ini entries. :) I still do no understand why recovery consol Bootcfg left me with incorrect boot.ini entries - I must have forgot a step? :confused: but I sucessfully booted all my OSs with what I think the boot.ini entries should be.:)

Paul Komski
11-12-2006, 03:15 PM
FYI

Partition enumeration (as opposed to HDD enumeration) is different under different OSes and under the DOS based OSes there is no numerical enumeration - just a dynamic assignment of drive letters, which is based on certain rules.

Under the NT-based OSes such as Win2K and WinXP primary partitions are enumerated first and logicals next. BUT and it can be a very big BUT the primary partition enumeration is based on their references in the partition tables and is not based on the physical position on the drive!!! This may not often be obvious because it is most usual for the four partition tables to be created "in parallel" with the four (can include one extended) partitions so that the references and the actual positions "mirror" each other.

An example to try to make it clearer; the values after the partition table numbers are respectively from left to right, the partition type in hex, the active partition (value 80=Active) and the number of LBA sectors prior to the start of the partition. I have left out the partition sizes and the CHS values to try to make it as clear as possible.

1) 04 00 63
2) 07 80 64260
3) 0F 00 20547135
4) 0C 00 66155670

The first entry is a small FAT16 partition, the second (active) partition is NTFS, the third is an extended and the fourth a FAT32 partition. The second entry is actually for a Windows XP installation and its correct boot.ini reference is partition(2).

The very same disk could have the partition tables looking like:

1) 07 80 64260
2) 04 00 63
3) 0F 00 20547135
4) 0C 00 66155670

The WinXP partition table entry is now its first entry and so its boot.ini reference should be partition(1) even though it is still the second partition on the drive.

For completeness yet another configuration could be:

1) 0F 00 20547135
2) 04 00 63
3) 07 80 64260
4) 0C 00 66155670

In this instance the WinXP partition is in the third partition table but its boot.ini reference would be partition(2) because it is the second partition to be enumerated PRIOR TO ANY LOGICAL PARTITIONS any of which would be in the extended partition referenced in what is now the first partition table entry. So the extended partiton itself has no partition reference number and it gets "ignored" since it appears prior to other primary partition references in the four tables.

Linux does things similarly by referencing partitions by their entries in the partition tables so that hda1, hda2, hda3 and hda4 reference the four primary partitions referenced in the tables. So the WinXP partition in the three examples above would be hda2, hda1 and hda3 respectively. Linux always gives a full reference to any extended partitions and the logical partitions always start with hda5, hda6 and so on. The first logical is always hda5 wheras the first logical partition reference under NT could be partition(1) in the absence of any primary partitions or (2) or (3) or (4) but not (5) because the extended partition is not referenced.

Thus without changing the layout of the hard drive at all both Linux and the NT OSes can fail to boot if the partition tables get changed around, either directly (you can do this in the MBR section of BiNG) or indirectly as a result of deleting, copying, re-imaging partitions and so on.

So if you have no way of editing boot.ini but do have a way of moving the partition tables around you have another method of correcting an incorrect boot.ini partition reference. ;)

PS If you can fully grasp what I have written you will probably also be able to grasp what up to now would have been inconsistencies in how boot.ini was supposed to work.