Which rdisk value in boot.ini maps to which disk?

Posted on

QUESTION :

Following are the contents of a sample boot.ini:

[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)WINDOWS="Microsoft Windows XP Professional" /NOEXECUTE=OPTIN /FASTDETECT
multi(0)disk(0)rdisk(0)partition(2)WINNT="Windows 2000 Professional" /fastdetect
multi(0)disk(0)rdisk(1)partition(1)WINDOWS="Microsoft Windows XP Home Edition" /NOEXECUTE=OPTIN /FASTDETECT

The rdisk value tells the physical disk number.

So, if I have three hard disks say:

  • /dev/sda

  • /dev/sdb

  • /dev/sdc

Then how to know which disk (/dev/sda or /dev/sdb or /dev/sdc) is rdisk(0) and which disk is rdisk(1), etc.?

ANSWER :

Trial and error?

I’m sure there is a method by which Windows orders the disks, but even if I knew it, I wouldn’t trust it and would alwasys check before changing stuff.

The boot.ini file gives you some clues, such as what operating system is on which disk. You may then be able to work it out from that. eg is there only one ntfs partition on a particular disk and two on others, what users are on each operating system and so have directories on each Windows system. You could even boot into each operating system and save a file in its system partition to help you.

(If you are trying to work out which disk a broken entry in boot.ini refers to, msconfig.exe has an option to check the boot paths to make sure that each option should boot.)

According to Microsoft article Q102873: BOOT.INI and ARC Path Naming Conventions and Usage, the order of rdisk() is:

… the ordinal for the disk on the adapter and is usually a number between 0 and 3.

So it seems it would be the usual order (starting with 0): primary master, primary slave, secondary master, secondary slave. (I have no idea how it works with SATA though.)

There may be another way to correctly access the drive you want. There is another syntax for the ARC id of a drive. A sample would be:

signature(13579BDF)disk(0)rdisk(0)partition(n)

which is supposed to make ntldr search for the disk with that disk serial number at offset 1B8h in the MBR. Described in “Windows internals” 4th edition by Russinovich and Solomon, on page 255. Haven’t tried this yet, though. Also, not sure if this a 32 bit integer or just 4 bytes – if the former, the bytes might required in the reverse order.

Leave a Reply

Your email address will not be published.