How Windows NT/W2k determines hard disk number

Hi,

On Windows NT/W2K, we can reference a specific hard disk by using
\Device\Harddiskx, where the ‘x’ is a zero-based number. Does anyone
know how windows determines this number? Is there any rule for disks
attached to IDE or SCSI controllers?

Thanks,

Andy

Disks are numbered sequentially as they are physically attached. But in case
hot swapping, disks are not numbered sequentially, If you remove and
reattach any disk then highest number is assigned.

You can get the correct sequence using IOCTL_SCSI_GET_INQUIRY_DATA but
before that you have to rescan the bus using IOCTL_SCSI_RESCAN_BUS.

-Prashant

On 7/18/05, Jinqiang Wang wrote:
>
> Hi,
>
> On Windows NT/W2K, we can reference a specific hard disk by using
> \Device\Harddiskx, where the ‘x’ is a zero-based number. Does anyone
> know how windows determines this number? Is there any rule for disks
> attached to IDE or SCSI controllers?
>
> Thanks,
>
> Andy
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

Prashant,

Thanks for your reply.

Does this sequence affected by BIOS settings? for example, if I set
the Slave disk on IDE channel 2 as the boot disk, and install Windows
on it, should this disk be harddisk0?

Thanks,

Andy

On 7/18/05, Prashant Bhosale wrote:
> Disks are numbered sequentially as they are physically attached. But in case
> hot swapping, disks are not numbered sequentially, If you remove and
> reattach any disk then highest number is assigned.
>
> You can get the correct sequence using IOCTL_SCSI_GET_INQUIRY_DATA but
> before that you have to rescan the bus using IOCTL_SCSI_RESCAN_BUS.
>
> -Prashant
>
>
> On 7/18/05, Jinqiang Wang wrote:
> >
> > Hi,
> >
> > On Windows NT/W2K, we can reference a specific hard disk by using
> > \Device\Harddiskx, where the ‘x’ is a zero-based number. Does anyone
> > know how windows determines this number? Is there any rule for disks
> > attached to IDE or SCSI controllers?
> >
> > Thanks,
> >
> > Andy
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
> > To unsubscribe send a blank email to
> xxxxx@lists.osr.com
> >
>
> — Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256 You are
> currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’ To
> unsubscribe send a blank email to
> xxxxx@lists.osr.com

I did not done it practically, but I think It should not affect. You can try
it out and check the sequence from registry at
HKLM->Hardware->DeviceMap->Scsi.
The same sequence is returned by SCSI_INQUIRY.

-Prashant

On 7/18/05, Jinqiang Wang wrote:
>
> Prashant,
>
> Thanks for your reply.
>
> Does this sequence affected by BIOS settings? for example, if I set
> the Slave disk on IDE channel 2 as the boot disk, and install Windows
> on it, should this disk be harddisk0?
>
> Thanks,
>
> Andy
>
> On 7/18/05, Prashant Bhosale wrote:
> > Disks are numbered sequentially as they are physically attached. But in
> case
> > hot swapping, disks are not numbered sequentially, If you remove and
> > reattach any disk then highest number is assigned.
> >
> > You can get the correct sequence using IOCTL_SCSI_GET_INQUIRY_DATA but
> > before that you have to rescan the bus using IOCTL_SCSI_RESCAN_BUS.
> >
> > -Prashant
> >
> >
> > On 7/18/05, Jinqiang Wang wrote:
> > >
> > > Hi,
> > >
> > > On Windows NT/W2K, we can reference a specific hard disk by using
> > > \Device\Harddiskx, where the ‘x’ is a zero-based number. Does anyone
> > > know how windows determines this number? Is there any rule for disks
> > > attached to IDE or SCSI controllers?
> > >
> > > Thanks,
> > >
> > > Andy
> > >
> > > —
> > > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> > >
> > > You are currently subscribed to ntdev as: unknown lmsubst tag
> argument: ‘’
> > > To unsubscribe send a blank email to
> > xxxxx@lists.osr.com
> > >
> >
> > — Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256 You are
> > currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’ To
> > unsubscribe send a blank email to
> > xxxxx@lists.osr.com
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

Prashant, the sequence is the same, thanks for your help :-), Andy

On 7/18/05, Prashant Bhosale wrote:
>
> I did not done it practically, but I think It should not affect. You can try
> it out and check the sequence from registry at
> HKLM->Hardware->DeviceMap->Scsi.
> The same sequence is returned by SCSI_INQUIRY.
>
> -Prashant
>
>
> On 7/18/05, Jinqiang Wang wrote:
> >
> > Prashant,
> >
> > Thanks for your reply.
> >
> > Does this sequence affected by BIOS settings? for example, if I set
> > the Slave disk on IDE channel 2 as the boot disk, and install Windows
> > on it, should this disk be harddisk0?
> >
> > Thanks,
> >
> > Andy
> >
> > On 7/18/05, Prashant Bhosale wrote:
> > > Disks are numbered sequentially as they are physically attached. But in
> case
> > > hot swapping, disks are not numbered sequentially, If you remove and
> > > reattach any disk then highest number is assigned.
> > >
> > > You can get the correct sequence using IOCTL_SCSI_GET_INQUIRY_DATA but
> > > before that you have to rescan the bus using IOCTL_SCSI_RESCAN_BUS.
> > >
> > > -Prashant
> > >
> > >
> > > On 7/18/05, Jinqiang Wang wrote:
> > > >
> > > > Hi,
> > > >
> > > > On Windows NT/W2K, we can reference a specific hard disk by using
> > > > \Device\Harddiskx, where the ‘x’ is a zero-based number. Does anyone
> > > > know how windows determines this number? Is there any rule for disks
> > > > attached to IDE or SCSI controllers?
> > > >
> > > > Thanks,
> > > >
> > > > Andy
> > > >
> > > > —
> > > > Questions? First check the Kernel Driver FAQ at
> > > http://www.osronline.com/article.cfm?id=256
> > > >
> > > > You are currently subscribed to ntdev as: unknown lmsubst tag
> argument: ‘’
> > > > To unsubscribe send a blank email to
> > > xxxxx@lists.osr.com
> > > >
> > >
> > > — Questions? First check the Kernel Driver FAQ at
> > > http://www.osronline.com/article.cfm?id=256 You are
> > > currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’ To
> > > unsubscribe send a blank email to
> > > xxxxx@lists.osr.com
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
> > To unsubscribe send a blank email to
> xxxxx@lists.osr.com
> >
>
> — Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256 You are
> currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’ To
> unsubscribe send a blank email to
> xxxxx@lists.osr.com

Bios settings may or may not affect it. The ordering is not guaranteed
to be deterministic - you can’t assume that disk 0 is your boot disk or
even that it’s the same disk it was the last time the system booted.

The better way to reference disks is using device interfaces. The
“path” that setupDI gives you back for a device’s interface is
persistant across boots (assuming the device isn’t moved to a different
bus address).

What is it you want to do with this information?

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Jinqiang Wang
Sent: Monday, July 18, 2005 12:21 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] How Windows NT/W2k determines hard disk number

Prashant,

Thanks for your reply.

Does this sequence affected by BIOS settings? for example, if I set the
Slave disk on IDE channel 2 as the boot disk, and install Windows on it,
should this disk be harddisk0?

Thanks,

Andy

On 7/18/05, Prashant Bhosale wrote:
> Disks are numbered sequentially as they are physically attached. But
> in case hot swapping, disks are not numbered sequentially, If you
> remove and reattach any disk then highest number is assigned.
>
> You can get the correct sequence using IOCTL_SCSI_GET_INQUIRY_DATA but

> before that you have to rescan the bus using IOCTL_SCSI_RESCAN_BUS.
>
> -Prashant
>
>
> On 7/18/05, Jinqiang Wang wrote:
> >
> > Hi,
> >
> > On Windows NT/W2K, we can reference a specific hard disk by using
> > \Device\Harddiskx, where the ‘x’ is a zero-based number. Does anyone

> > know how windows determines this number? Is there any rule for disks

> > attached to IDE or SCSI controllers?
> >
> > Thanks,
> >
> > Andy
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: unknown lmsubst tag
argument: ‘’
> > To unsubscribe send a blank email to
> xxxxx@lists.osr.com
> >
>
> — Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256 You are currently
> subscribed to ntdev as: unknown lmsubst tag argument: ‘’ To
> unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument:
‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

Hi Peter,

I’m trying to record partition layout of all hard disks, and, when
there is failure of any disk, I restore the partition layouts.

Just think of this senario, I setup a system with one OEM SCSI adapter
and a few disks. after that, I attach another SCSI adapter which
driver is “in the box” with Widnows. If I try to reinstall Windows on
this system, the disks attached to the SCSI adapter using retail
driver will be recognized first and the I have to make a system
partition on the first disk. I noticed that if the driver loaded first
at setup time, disks attached to that SCSI adapter will be seen first.

Any comment will be appreciate.

Thanks,

Andy

On 7/19/05, Peter Wieland wrote:
> Bios settings may or may not affect it. The ordering is not guaranteed
> to be deterministic - you can’t assume that disk 0 is your boot disk or
> even that it’s the same disk it was the last time the system booted.
>
> The better way to reference disks is using device interfaces. The
> “path” that setupDI gives you back for a device’s interface is
> persistant across boots (assuming the device isn’t moved to a different
> bus address).
>
> What is it you want to do with this information?
>
> -p
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Jinqiang Wang
> Sent: Monday, July 18, 2005 12:21 AM
> To: Windows System Software Devs Interest List
> Subject: Re: [ntdev] How Windows NT/W2k determines hard disk number
>
> Prashant,
>
> Thanks for your reply.
>
> Does this sequence affected by BIOS settings? for example, if I set the
> Slave disk on IDE channel 2 as the boot disk, and install Windows on it,
> should this disk be harddisk0?
>
> Thanks,
>
> Andy
>
> On 7/18/05, Prashant Bhosale wrote:
> > Disks are numbered sequentially as they are physically attached. But
> > in case hot swapping, disks are not numbered sequentially, If you
> > remove and reattach any disk then highest number is assigned.
> >
> > You can get the correct sequence using IOCTL_SCSI_GET_INQUIRY_DATA but
>
> > before that you have to rescan the bus using IOCTL_SCSI_RESCAN_BUS.
> >
> > -Prashant
> >
> >
> > On 7/18/05, Jinqiang Wang wrote:
> > >
> > > Hi,
> > >
> > > On Windows NT/W2K, we can reference a specific hard disk by using
> > > \Device\Harddiskx, where the ‘x’ is a zero-based number. Does anyone
>
> > > know how windows determines this number? Is there any rule for disks
>
> > > attached to IDE or SCSI controllers?
> > >
> > > Thanks,
> > >
> > > Andy
> > >
> > > —
> > > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> > >
> > > You are currently subscribed to ntdev as: unknown lmsubst tag
> argument: ‘’
> > > To unsubscribe send a blank email to
> > xxxxx@lists.osr.com
> > >
> >
> > — Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256 You are currently
> > subscribed to ntdev as: unknown lmsubst tag argument: ‘’ To
> > unsubscribe send a blank email to xxxxx@lists.osr.com
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: unknown lmsubst tag argument:
> ‘’
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
> —
> Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

You cannot rely on the name of the disk (harddisk0 for example.) You could
rely on the unique physical disk serial number. This is position
independent. SCSI/IDE/SATA drives all provide unique physical disk serial
numbers. Many systems have storage enclosures that allow disks to be moved
from one slot to another and from one enclosure (and bus) to another. The
constant identifier in such cases is the serial number.

=====================
Mark Roddy DDK MVP
Windows 2003/XP/2000 Consulting
Hollis Technology Solutions 603-321-1032
www.hollistech.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Jinqiang Wang
Sent: Monday, July 18, 2005 9:09 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] How Windows NT/W2k determines hard disk number

Hi Peter,

I’m trying to record partition layout of all hard disks, and,
when there is failure of any disk, I restore the partition layouts.

Just think of this senario, I setup a system with one OEM
SCSI adapter and a few disks. after that, I attach another
SCSI adapter which driver is “in the box” with Widnows. If I
try to reinstall Windows on this system, the disks attached
to the SCSI adapter using retail driver will be recognized
first and the I have to make a system partition on the first
disk. I noticed that if the driver loaded first at setup
time, disks attached to that SCSI adapter will be seen first.

Any comment will be appreciate.

Thanks,

Andy

On 7/19/05, Peter Wieland wrote:
> > Bios settings may or may not affect it. The ordering is not
> > guaranteed to be deterministic - you can’t assume that disk
> 0 is your
> > boot disk or even that it’s the same disk it was the last
> time the system booted.
> >
> > The better way to reference disks is using device interfaces. The
> > “path” that setupDI gives you back for a device’s interface is
> > persistant across boots (assuming the device isn’t moved to a
> > different bus address).
> >
> > What is it you want to do with this information?
> >
> > -p
> >
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Jinqiang Wang
> > Sent: Monday, July 18, 2005 12:21 AM
> > To: Windows System Software Devs Interest List
> > Subject: Re: [ntdev] How Windows NT/W2k determines hard disk number
> >
> > Prashant,
> >
> > Thanks for your reply.
> >
> > Does this sequence affected by BIOS settings? for example, if I set
> > the Slave disk on IDE channel 2 as the boot disk, and
> install Windows
> > on it, should this disk be harddisk0?
> >
> > Thanks,
> >
> > Andy
> >
> > On 7/18/05, Prashant Bhosale wrote:
> > > Disks are numbered sequentially as they are physically
> attached. But
> > > in case hot swapping, disks are not numbered sequentially, If you
> > > remove and reattach any disk then highest number is assigned.
> > >
> > > You can get the correct sequence using
> IOCTL_SCSI_GET_INQUIRY_DATA
> > > but
> >
> > > before that you have to rescan the bus using
> IOCTL_SCSI_RESCAN_BUS.
> > >
> > > -Prashant
> > >
> > >
> > > On 7/18/05, Jinqiang Wang wrote:
> > > >
> > > > Hi,
> > > >
> > > > On Windows NT/W2K, we can reference a specific hard
> disk by using
> > > > \Device\Harddiskx, where the ‘x’ is a zero-based number. Does
> > > > anyone
> >
> > > > know how windows determines this number? Is there any rule for
> > > > disks
> >
> > > > attached to IDE or SCSI controllers?
> > > >
> > > > Thanks,
> > > >
> > > > Andy
> > > >
> > > > —
> > > > Questions? First check the Kernel Driver FAQ at
> > > http://www.osronline.com/article.cfm?id=256
> > > >
> > > > You are currently subscribed to ntdev as: unknown lmsubst tag
> > argument: ‘’
> > > > To unsubscribe send a blank email to
> > > xxxxx@lists.osr.com
> > > >
> > >
> > > — Questions? First check the Kernel Driver FAQ at
> > > http://www.osronline.com/article.cfm?id=256 You are currently
> > > subscribed to ntdev as: unknown lmsubst tag argument: ‘’ To
> > > unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: unknown lmsubst
> tag argument:
> > ‘’
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: unknown lmsubst
> tag argument: ‘’
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: unknown lmsubst tag
> argument: ‘’
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

Hi Mark,

Thanks for your idea. In my case, I think remembering the location of
disks is acceptable. If I use disk serial number, what should I do if
one disk is broken and replaced by new one? Changing this serial
number manually might be a solution but the customer will not like it.

Thanks,

Andy

On 7/19/05, Mark Roddy wrote:
> You cannot rely on the name of the disk (harddisk0 for example.) You could
> rely on the unique physical disk serial number. This is position
> independent. SCSI/IDE/SATA drives all provide unique physical disk serial
> numbers. Many systems have storage enclosures that allow disks to be moved
> from one slot to another and from one enclosure (and bus) to another. The
> constant identifier in such cases is the serial number.
>
> =====================
> Mark Roddy DDK MVP
> Windows 2003/XP/2000 Consulting
> Hollis Technology Solutions 603-321-1032
> www.hollistech.com
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Jinqiang Wang
> > Sent: Monday, July 18, 2005 9:09 PM
> > To: Windows System Software Devs Interest List
> > Subject: Re: [ntdev] How Windows NT/W2k determines hard disk number
> >
> > Hi Peter,
> >
> > I’m trying to record partition layout of all hard disks, and,
> > when there is failure of any disk, I restore the partition layouts.
> >
> > Just think of this senario, I setup a system with one OEM
> > SCSI adapter and a few disks. after that, I attach another
> > SCSI adapter which driver is “in the box” with Widnows. If I
> > try to reinstall Windows on this system, the disks attached
> > to the SCSI adapter using retail driver will be recognized
> > first and the I have to make a system partition on the first
> > disk. I noticed that if the driver loaded first at setup
> > time, disks attached to that SCSI adapter will be seen first.
> >
> > Any comment will be appreciate.
> >
> > Thanks,
> >
> > Andy
> >
> > On 7/19/05, Peter Wieland wrote:
> > > Bios settings may or may not affect it. The ordering is not
> > > guaranteed to be deterministic - you can’t assume that disk
> > 0 is your
> > > boot disk or even that it’s the same disk it was the last
> > time the system booted.
> > >
> > > The better way to reference disks is using device interfaces. The
> > > “path” that setupDI gives you back for a device’s interface is
> > > persistant across boots (assuming the device isn’t moved to a
> > > different bus address).
> > >
> > > What is it you want to do with this information?
> > >
> > > -p
> > >
> > > -----Original Message-----
> > > From: xxxxx@lists.osr.com
> > > [mailto:xxxxx@lists.osr.com] On Behalf Of Jinqiang Wang
> > > Sent: Monday, July 18, 2005 12:21 AM
> > > To: Windows System Software Devs Interest List
> > > Subject: Re: [ntdev] How Windows NT/W2k determines hard disk number
> > >
> > > Prashant,
> > >
> > > Thanks for your reply.
> > >
> > > Does this sequence affected by BIOS settings? for example, if I set
> > > the Slave disk on IDE channel 2 as the boot disk, and
> > install Windows
> > > on it, should this disk be harddisk0?
> > >
> > > Thanks,
> > >
> > > Andy
> > >
> > > On 7/18/05, Prashant Bhosale wrote:
> > > > Disks are numbered sequentially as they are physically
> > attached. But
> > > > in case hot swapping, disks are not numbered sequentially, If you
> > > > remove and reattach any disk then highest number is assigned.
> > > >
> > > > You can get the correct sequence using
> > IOCTL_SCSI_GET_INQUIRY_DATA
> > > > but
> > >
> > > > before that you have to rescan the bus using
> > IOCTL_SCSI_RESCAN_BUS.
> > > >
> > > > -Prashant
> > > >
> > > >
> > > > On 7/18/05, Jinqiang Wang wrote:
> > > > >
> > > > > Hi,
> > > > >
> > > > > On Windows NT/W2K, we can reference a specific hard
> > disk by using
> > > > > \Device\Harddiskx, where the ‘x’ is a zero-based number. Does
> > > > > anyone
> > >
> > > > > know how windows determines this number? Is there any rule for
> > > > > disks
> > >
> > > > > attached to IDE or SCSI controllers?
> > > > >
> > > > > Thanks,
> > > > >
> > > > > Andy
> > > > >
> > > > > —
> > > > > Questions? First check the Kernel Driver FAQ at
> > > > http://www.osronline.com/article.cfm?id=256
> > > > >
> > > > > You are currently subscribed to ntdev as: unknown lmsubst tag
> > > argument: ‘’
> > > > > To unsubscribe send a blank email to
> > > > xxxxx@lists.osr.com
> > > > >
> > > >
> > > > — Questions? First check the Kernel Driver FAQ at
> > > > http://www.osronline.com/article.cfm?id=256 You are currently
> > > > subscribed to ntdev as: unknown lmsubst tag argument: ‘’ To
> > > > unsubscribe send a blank email to xxxxx@lists.osr.com
> > >
> > > —
> > > Questions? First check the Kernel Driver FAQ at
> > > http://www.osronline.com/article.cfm?id=256
> > >
> > > You are currently subscribed to ntdev as: unknown lmsubst
> > tag argument:
> > > ‘’
> > > To unsubscribe send a blank email to xxxxx@lists.osr.com
> > >
> > > —
> > > Questions? First check the Kernel Driver FAQ at
> > > http://www.osronline.com/article.cfm?id=256
> > >
> > > You are currently subscribed to ntdev as: unknown lmsubst
> > tag argument: ‘’
> > > To unsubscribe send a blank email to xxxxx@lists.osr.com
> > >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: unknown lmsubst tag
> > argument: ‘’
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@gmail.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

Unfortunately not all disks have unique serial numbers although if they
do, and if they were unique (if only), that would be a good start. You
could also use the same information that the volume manager uses - disk
signature and partition start/size. Take a look at IOCTL_DISK_GET_* for
example:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/
fs/ioctl_disk_get_drive_layout.asp

Use SetupDi calls to get the devices you are interested in.

-----Original Message-----
From: Jinqiang Wang [mailto:xxxxx@gmail.com]
Sent: Monday, July 18, 2005 9:34 PM
Subject: Re: How Windows NT/W2k determines hard disk number

Hi Mark,

Thanks for your idea. In my case, I think remembering the location of
disks is acceptable. If I use disk serial number, what should I do if
one disk is broken and replaced by new one? Changing this serial
number manually might be a solution but the customer will not like it.

Thanks,

Andy

On 7/19/05, Mark Roddy wrote:
> You cannot rely on the name of the disk (harddisk0 for example.) You
could
> rely on the unique physical disk serial number. This is position
> independent. SCSI/IDE/SATA drives all provide unique physical disk
serial
> numbers. Many systems have storage enclosures that allow disks to be
moved
> from one slot to another and from one enclosure (and bus) to another.
The
> constant identifier in such cases is the serial number.
>
> =====================
> Mark Roddy DDK MVP
> Windows 2003/XP/2000 Consulting
> Hollis Technology Solutions 603-321-1032
> www.hollistech.com
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Jinqiang Wang
> > Sent: Monday, July 18, 2005 9:09 PM
> > To: Windows System Software Devs Interest List
> > Subject: Re: [ntdev] How Windows NT/W2k determines hard disk number
> >
> > Hi Peter,
> >
> > I’m trying to record partition layout of all hard disks, and,
> > when there is failure of any disk, I restore the partition layouts.
> >
> > Just think of this senario, I setup a system with one OEM
> > SCSI adapter and a few disks. after that, I attach another
> > SCSI adapter which driver is “in the box” with Widnows. If I
> > try to reinstall Windows on this system, the disks attached
> > to the SCSI adapter using retail driver will be recognized
> > first and the I have to make a system partition on the first
> > disk. I noticed that if the driver loaded first at setup
> > time, disks attached to that SCSI adapter will be seen first.
> >
> > Any comment will be appreciate.
> >
> > Thanks,
> >
> > Andy
> >
> > On 7/19/05, Peter Wieland wrote:
> > > Bios settings may or may not affect it. The ordering is not
> > > guaranteed to be deterministic - you can’t assume that disk
> > 0 is your
> > > boot disk or even that it’s the same disk it was the last
> > time the system booted.
> > >
> > > The better way to reference disks is using device interfaces. The
> > > “path” that setupDI gives you back for a device’s interface is
> > > persistant across boots (assuming the device isn’t moved to a
> > > different bus address).
> > >
> > > What is it you want to do with this information?
> > >
> > > -p
> > >
> > > -----Original Message-----
> > > From: xxxxx@lists.osr.com
> > > [mailto:xxxxx@lists.osr.com] On Behalf Of Jinqiang
Wang
> > > Sent: Monday, July 18, 2005 12:21 AM
> > > To: Windows System Software Devs Interest List
> > > Subject: Re: [ntdev] How Windows NT/W2k determines hard disk
number
> > >
> > > Prashant,
> > >
> > > Thanks for your reply.
> > >
> > > Does this sequence affected by BIOS settings? for example, if I
set
> > > the Slave disk on IDE channel 2 as the boot disk, and
> > install Windows
> > > on it, should this disk be harddisk0?
> > >
> > > Thanks,
> > >
> > > Andy
> > >
> > > On 7/18/05, Prashant Bhosale wrote:
> > > > Disks are numbered sequentially as they are physically
> > attached. But
> > > > in case hot swapping, disks are not numbered sequentially, If
you
> > > > remove and reattach any disk then highest number is assigned.
> > > >
> > > > You can get the correct sequence using
> > IOCTL_SCSI_GET_INQUIRY_DATA
> > > > but
> > >
> > > > before that you have to rescan the bus using
> > IOCTL_SCSI_RESCAN_BUS.
> > > >
> > > > -Prashant
> > > >
> > > >
> > > > On 7/18/05, Jinqiang Wang wrote:
> > > > >
> > > > > Hi,
> > > > >
> > > > > On Windows NT/W2K, we can reference a specific hard
> > disk by using
> > > > > \Device\Harddiskx, where the ‘x’ is a zero-based number. Does
> > > > > anyone
> > >
> > > > > know how windows determines this number? Is there any rule for
> > > > > disks
> > >
> > > > > attached to IDE or SCSI controllers?
> > > > >
> > > > > Thanks,
> > > > >
> > > > > Andy
> > > > >
> > > > > —
> > > > > Questions? First check the Kernel Driver FAQ at
> > > > http://www.osronline.com/article.cfm?id=256
> > > > >
> > > > > You are currently subscribed to ntdev as: unknown lmsubst tag
> > > argument: ‘’
> > > > > To unsubscribe send a blank email to
> > > > xxxxx@lists.osr.com
> > > > >
> > > >
> > > > — Questions? First check the Kernel Driver FAQ at
> > > > http://www.osronline.com/article.cfm?id=256 You are currently
> > > > subscribed to ntdev as: unknown lmsubst tag argument: ‘’ To
> > > > unsubscribe send a blank email to
xxxxx@lists.osr.com
> > >
> > > —
> > > Questions? First check the Kernel Driver FAQ at
> > > http://www.osronline.com/article.cfm?id=256
> > >
> > > You are currently subscribed to ntdev as: unknown lmsubst
> > tag argument:
> > > ‘’
> > > To unsubscribe send a blank email to
xxxxx@lists.osr.com
> > >
> > > —
> > > Questions? First check the Kernel Driver FAQ at
> > > http://www.osronline.com/article.cfm?id=256
> > >
> > > You are currently subscribed to ntdev as: unknown lmsubst
> > tag argument: ‘’
> > > To unsubscribe send a blank email to
xxxxx@lists.osr.com
> > >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: unknown lmsubst tag
> > argument: ‘’
> > To unsubscribe send a blank email to
xxxxx@lists.osr.com
> >
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@gmail.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

Your database entry for that disk changes to reflect the replacement disk’s
serial number. In most cases it would be difficult to change the disk vendor
serial number.

=====================
Mark Roddy DDK MVP
Windows 2003/XP/2000 Consulting
Hollis Technology Solutions 603-321-1032
www.hollistech.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Jinqiang Wang
Sent: Tuesday, July 19, 2005 12:34 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] How Windows NT/W2k determines hard disk number

Hi Mark,

Thanks for your idea. In my case, I think remembering the
location of disks is acceptable. If I use disk serial number,
what should I do if one disk is broken and replaced by new
one? Changing this serial number manually might be a solution
but the customer will not like it.

Thanks,

Andy

On 7/19/05, Mark Roddy wrote:
> > You cannot rely on the name of the disk (harddisk0 for
> example.) You
> > could rely on the unique physical disk serial number. This
> is position
> > independent. SCSI/IDE/SATA drives all provide unique physical disk
> > serial numbers. Many systems have storage enclosures that
> allow disks
> > to be moved from one slot to another and from one enclosure
> (and bus)
> > to another. The constant identifier in such cases is the
> serial number.
> >
> > =====================
> > Mark Roddy DDK MVP
> > Windows 2003/XP/2000 Consulting
> > Hollis Technology Solutions 603-321-1032 www.hollistech.com
> >
> > > -----Original Message-----
> > > From: xxxxx@lists.osr.com
> > > [mailto:xxxxx@lists.osr.com] On Behalf Of
> Jinqiang Wang
> > > Sent: Monday, July 18, 2005 9:09 PM
> > > To: Windows System Software Devs Interest List
> > > Subject: Re: [ntdev] How Windows NT/W2k determines hard
> disk number
> > >
> > > Hi Peter,
> > >
> > > I’m trying to record partition layout of all hard disks,
> and, when
> > > there is failure of any disk, I restore the partition layouts.
> > >
> > > Just think of this senario, I setup a system with one OEM SCSI
> > > adapter and a few disks. after that, I attach another
> SCSI adapter
> > > which driver is “in the box” with Widnows. If I try to reinstall
> > > Windows on this system, the disks attached to the SCSI
> adapter using
> > > retail driver will be recognized first and the I have to make a
> > > system partition on the first disk. I noticed that if the driver
> > > loaded first at setup time, disks attached to that SCSI
> adapter will
> > > be seen first.
> > >
> > > Any comment will be appreciate.
> > >
> > > Thanks,
> > >
> > > Andy
> > >
> > > On 7/19/05, Peter Wieland wrote:
> > > > Bios settings may or may not affect it. The ordering is not
> > > > guaranteed to be deterministic - you can’t assume that disk
> > > 0 is your
> > > > boot disk or even that it’s the same disk it was the last
> > > time the system booted.
> > > >
> > > > The better way to reference disks is using device
> interfaces. The
> > > > “path” that setupDI gives you back for a device’s interface is
> > > > persistant across boots (assuming the device isn’t moved to a
> > > > different bus address).
> > > >
> > > > What is it you want to do with this information?
> > > >
> > > > -p
> > > >
> > > > -----Original Message-----
> > > > From: xxxxx@lists.osr.com
> > > > [mailto:xxxxx@lists.osr.com] On Behalf Of Jinqiang
> > > > Wang
> > > > Sent: Monday, July 18, 2005 12:21 AM
> > > > To: Windows System Software Devs Interest List
> > > > Subject: Re: [ntdev] How Windows NT/W2k determines hard disk
> > > > number
> > > >
> > > > Prashant,
> > > >
> > > > Thanks for your reply.
> > > >
> > > > Does this sequence affected by BIOS settings? for example, if I
> > > > set the Slave disk on IDE channel 2 as the boot disk, and
> > > install Windows
> > > > on it, should this disk be harddisk0?
> > > >
> > > > Thanks,
> > > >
> > > > Andy
> > > >
> > > > On 7/18/05, Prashant Bhosale wrote:
> > > > > Disks are numbered sequentially as they are physically
> > > attached. But
> > > > > in case hot swapping, disks are not numbered sequentially, If
> > > > > you remove and reattach any disk then highest number
> is assigned.
> > > > >
> > > > > You can get the correct sequence using
> > > IOCTL_SCSI_GET_INQUIRY_DATA
> > > > > but
> > > >
> > > > > before that you have to rescan the bus using
> > > IOCTL_SCSI_RESCAN_BUS.
> > > > >
> > > > > -Prashant
> > > > >
> > > > >
> > > > > On 7/18/05, Jinqiang Wang wrote:
> > > > > >
> > > > > > Hi,
> > > > > >
> > > > > > On Windows NT/W2K, we can reference a specific hard
> > > disk by using
> > > > > > \Device\Harddiskx, where the ‘x’ is a zero-based
> number. Does
> > > > > > anyone
> > > >
> > > > > > know how windows determines this number? Is there
> any rule for
> > > > > > disks
> > > >
> > > > > > attached to IDE or SCSI controllers?
> > > > > >
> > > > > > Thanks,
> > > > > >
> > > > > > Andy
> > > > > >
> > > > > > —
> > > > > > Questions? First check the Kernel Driver FAQ at
> > > > > http://www.osronline.com/article.cfm?id=256
> > > > > >
> > > > > > You are currently subscribed to ntdev as: unknown
> lmsubst tag
> > > > argument: ‘’
> > > > > > To unsubscribe send a blank email to
> > > > > xxxxx@lists.osr.com
> > > > > >
> > > > >
> > > > > — Questions? First check the Kernel Driver FAQ at
> > > > > http://www.osronline.com/article.cfm?id=256 You are currently
> > > > > subscribed to ntdev as: unknown lmsubst tag argument: ‘’ To
> > > > > unsubscribe send a blank email to
> > > > > xxxxx@lists.osr.com
> > > >
> > > > —
> > > > Questions? First check the Kernel Driver FAQ at
> > > > http://www.osronline.com/article.cfm?id=256
> > > >
> > > > You are currently subscribed to ntdev as: unknown lmsubst
> > > tag argument:
> > > > ‘’
> > > > To unsubscribe send a blank email to
> > > > xxxxx@lists.osr.com
> > > >
> > > > —
> > > > Questions? First check the Kernel Driver FAQ at
> > > > http://www.osronline.com/article.cfm?id=256
> > > >
> > > > You are currently subscribed to ntdev as: unknown lmsubst
> > > tag argument: ‘’
> > > > To unsubscribe send a blank email to
> > > > xxxxx@lists.osr.com
> > > >
> > >
> > > —
> > > Questions? First check the Kernel Driver FAQ at
> > > http://www.osronline.com/article.cfm?id=256
> > >
> > > You are currently subscribed to ntdev as: unknown lmsubst tag
> > > argument: ‘’
> > > To unsubscribe send a blank email to
> xxxxx@lists.osr.com
> > >
> >
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: xxxxx@gmail.com To
> > unsubscribe send a blank email to xxxxx@lists.osr.com
> >
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: unknown lmsubst tag
> argument: ‘’
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

A global counter inside disk.sys binary, incremented before each next
device object creation.

In w2k and later, these names are the symlinks to the real names for
compatibility with the old NT4 naming. The real names are other.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Jinqiang Wang”
To: “Windows System Software Devs Interest List”
Sent: Monday, July 18, 2005 9:09 AM
Subject: [ntdev] How Windows NT/W2k determines hard disk number

Hi,

On Windows NT/W2K, we can reference a specific hard disk by using
\Device\Harddiskx, where the ‘x’ is a zero-based number. Does anyone
know how windows determines this number? Is there any rule for disks
attached to IDE or SCSI controllers?

Thanks,

Andy


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

No. There are \ArcName symlinks which use the BIOS disk numbering.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Jinqiang Wang”
To: “Windows System Software Devs Interest List”
Sent: Monday, July 18, 2005 11:20 AM
Subject: Re: [ntdev] How Windows NT/W2k determines hard disk number

Prashant,

Thanks for your reply.

Does this sequence affected by BIOS settings? for example, if I set
the Slave disk on IDE channel 2 as the boot disk, and install Windows
on it, should this disk be harddisk0?

Thanks,

Andy

On 7/18/05, Prashant Bhosale wrote:
> Disks are numbered sequentially as they are physically attached. But in case
> hot swapping, disks are not numbered sequentially, If you remove and
> reattach any disk then highest number is assigned.
>
> You can get the correct sequence using IOCTL_SCSI_GET_INQUIRY_DATA but
> before that you have to rescan the bus using IOCTL_SCSI_RESCAN_BUS.
>
> -Prashant
>
>
> On 7/18/05, Jinqiang Wang wrote:
> >
> > Hi,
> >
> > On Windows NT/W2K, we can reference a specific hard disk by using
> > \Device\Harddiskx, where the ‘x’ is a zero-based number. Does anyone
> > know how windows determines this number? Is there any rule for disks
> > attached to IDE or SCSI controllers?
> >
> > Thanks,
> >
> > Andy
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
> > To unsubscribe send a blank email to
> xxxxx@lists.osr.com
> >
>
> — Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256 You are
> currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’ To
> unsubscribe send a blank email to
> xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

Exactly. The load order of the miniports is what affects the hard disk
numbering in Windows.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Jinqiang Wang”
To: “Windows System Software Devs Interest List”
Sent: Tuesday, July 19, 2005 5:08 AM
Subject: Re: [ntdev] How Windows NT/W2k determines hard disk number

Hi Peter,

I’m trying to record partition layout of all hard disks, and, when
there is failure of any disk, I restore the partition layouts.

Just think of this senario, I setup a system with one OEM SCSI adapter
and a few disks. after that, I attach another SCSI adapter which
driver is “in the box” with Widnows. If I try to reinstall Windows on
this system, the disks attached to the SCSI adapter using retail
driver will be recognized first and the I have to make a system
partition on the first disk. I noticed that if the driver loaded first
at setup time, disks attached to that SCSI adapter will be seen first.

Any comment will be appreciate.

Thanks,

Andy

On 7/19/05, Peter Wieland wrote:
> Bios settings may or may not affect it. The ordering is not guaranteed
> to be deterministic - you can’t assume that disk 0 is your boot disk or
> even that it’s the same disk it was the last time the system booted.
>
> The better way to reference disks is using device interfaces. The
> “path” that setupDI gives you back for a device’s interface is
> persistant across boots (assuming the device isn’t moved to a different
> bus address).
>
> What is it you want to do with this information?
>
> -p
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Jinqiang Wang
> Sent: Monday, July 18, 2005 12:21 AM
> To: Windows System Software Devs Interest List
> Subject: Re: [ntdev] How Windows NT/W2k determines hard disk number
>
> Prashant,
>
> Thanks for your reply.
>
> Does this sequence affected by BIOS settings? for example, if I set the
> Slave disk on IDE channel 2 as the boot disk, and install Windows on it,
> should this disk be harddisk0?
>
> Thanks,
>
> Andy
>
> On 7/18/05, Prashant Bhosale wrote:
> > Disks are numbered sequentially as they are physically attached. But
> > in case hot swapping, disks are not numbered sequentially, If you
> > remove and reattach any disk then highest number is assigned.
> >
> > You can get the correct sequence using IOCTL_SCSI_GET_INQUIRY_DATA but
>
> > before that you have to rescan the bus using IOCTL_SCSI_RESCAN_BUS.
> >
> > -Prashant
> >
> >
> > On 7/18/05, Jinqiang Wang wrote:
> > >
> > > Hi,
> > >
> > > On Windows NT/W2K, we can reference a specific hard disk by using
> > > \Device\Harddiskx, where the ‘x’ is a zero-based number. Does anyone
>
> > > know how windows determines this number? Is there any rule for disks
>
> > > attached to IDE or SCSI controllers?
> > >
> > > Thanks,
> > >
> > > Andy
> > >
> > > —
> > > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> > >
> > > You are currently subscribed to ntdev as: unknown lmsubst tag
> argument: ‘’
> > > To unsubscribe send a blank email to
> > xxxxx@lists.osr.com
> > >
> >
> > — Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256 You are currently
> > subscribed to ntdev as: unknown lmsubst tag argument: ‘’ To
> > unsubscribe send a blank email to xxxxx@lists.osr.com
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: unknown lmsubst tag argument:
> ‘’
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

Partition table signature is also a good thing. Windows itself (MountMgr)
uses it to assign the drive letters.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Mark Roddy”
To: “Windows System Software Devs Interest List”
Sent: Tuesday, July 19, 2005 7:09 AM
Subject: RE: [ntdev] How Windows NT/W2k determines hard disk number

> You cannot rely on the name of the disk (harddisk0 for example.) You could
> rely on the unique physical disk serial number. This is position
> independent. SCSI/IDE/SATA drives all provide unique physical disk serial
> numbers. Many systems have storage enclosures that allow disks to be moved
> from one slot to another and from one enclosure (and bus) to another. The
> constant identifier in such cases is the serial number.
>
> =====================
> Mark Roddy DDK MVP
> Windows 2003/XP/2000 Consulting
> Hollis Technology Solutions 603-321-1032
> www.hollistech.com
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Jinqiang Wang
> > Sent: Monday, July 18, 2005 9:09 PM
> > To: Windows System Software Devs Interest List
> > Subject: Re: [ntdev] How Windows NT/W2k determines hard disk number
> >
> > Hi Peter,
> >
> > I’m trying to record partition layout of all hard disks, and,
> > when there is failure of any disk, I restore the partition layouts.
> >
> > Just think of this senario, I setup a system with one OEM
> > SCSI adapter and a few disks. after that, I attach another
> > SCSI adapter which driver is “in the box” with Widnows. If I
> > try to reinstall Windows on this system, the disks attached
> > to the SCSI adapter using retail driver will be recognized
> > first and the I have to make a system partition on the first
> > disk. I noticed that if the driver loaded first at setup
> > time, disks attached to that SCSI adapter will be seen first.
> >
> > Any comment will be appreciate.
> >
> > Thanks,
> >
> > Andy
> >
> > On 7/19/05, Peter Wieland wrote:
> > > Bios settings may or may not affect it. The ordering is not
> > > guaranteed to be deterministic - you can’t assume that disk
> > 0 is your
> > > boot disk or even that it’s the same disk it was the last
> > time the system booted.
> > >
> > > The better way to reference disks is using device interfaces. The
> > > “path” that setupDI gives you back for a device’s interface is
> > > persistant across boots (assuming the device isn’t moved to a
> > > different bus address).
> > >
> > > What is it you want to do with this information?
> > >
> > > -p
> > >
> > > -----Original Message-----
> > > From: xxxxx@lists.osr.com
> > > [mailto:xxxxx@lists.osr.com] On Behalf Of Jinqiang Wang
> > > Sent: Monday, July 18, 2005 12:21 AM
> > > To: Windows System Software Devs Interest List
> > > Subject: Re: [ntdev] How Windows NT/W2k determines hard disk number
> > >
> > > Prashant,
> > >
> > > Thanks for your reply.
> > >
> > > Does this sequence affected by BIOS settings? for example, if I set
> > > the Slave disk on IDE channel 2 as the boot disk, and
> > install Windows
> > > on it, should this disk be harddisk0?
> > >
> > > Thanks,
> > >
> > > Andy
> > >
> > > On 7/18/05, Prashant Bhosale wrote:
> > > > Disks are numbered sequentially as they are physically
> > attached. But
> > > > in case hot swapping, disks are not numbered sequentially, If you
> > > > remove and reattach any disk then highest number is assigned.
> > > >
> > > > You can get the correct sequence using
> > IOCTL_SCSI_GET_INQUIRY_DATA
> > > > but
> > >
> > > > before that you have to rescan the bus using
> > IOCTL_SCSI_RESCAN_BUS.
> > > >
> > > > -Prashant
> > > >
> > > >
> > > > On 7/18/05, Jinqiang Wang wrote:
> > > > >
> > > > > Hi,
> > > > >
> > > > > On Windows NT/W2K, we can reference a specific hard
> > disk by using
> > > > > \Device\Harddiskx, where the ‘x’ is a zero-based number. Does
> > > > > anyone
> > >
> > > > > know how windows determines this number? Is there any rule for
> > > > > disks
> > >
> > > > > attached to IDE or SCSI controllers?
> > > > >
> > > > > Thanks,
> > > > >
> > > > > Andy
> > > > >
> > > > > —
> > > > > Questions? First check the Kernel Driver FAQ at
> > > > http://www.osronline.com/article.cfm?id=256
> > > > >
> > > > > You are currently subscribed to ntdev as: unknown lmsubst tag
> > > argument: ‘’
> > > > > To unsubscribe send a blank email to
> > > > xxxxx@lists.osr.com
> > > > >
> > > >
> > > > — Questions? First check the Kernel Driver FAQ at
> > > > http://www.osronline.com/article.cfm?id=256 You are currently
> > > > subscribed to ntdev as: unknown lmsubst tag argument: ‘’ To
> > > > unsubscribe send a blank email to xxxxx@lists.osr.com
> > >
> > > —
> > > Questions? First check the Kernel Driver FAQ at
> > > http://www.osronline.com/article.cfm?id=256
> > >
> > > You are currently subscribed to ntdev as: unknown lmsubst
> > tag argument:
> > > ‘’
> > > To unsubscribe send a blank email to xxxxx@lists.osr.com
> > >
> > > —
> > > Questions? First check the Kernel Driver FAQ at
> > > http://www.osronline.com/article.cfm?id=256
> > >
> > > You are currently subscribed to ntdev as: unknown lmsubst
> > tag argument: ‘’
> > > To unsubscribe send a blank email to xxxxx@lists.osr.com
> > >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: unknown lmsubst tag
> > argument: ‘’
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com

Hi Maxim,

Thanks for your comments.

I noticed that the loader order of miniport drivers actually
determines the disk numbering. Another issus is that the tag value of
miniport drivers. If the OEM driver defines tag value, and this value
precedes a retail driver, then the disk numbering will be different
during windows text mode setup and during normal running mode. seems
that this issue can only be solved by mapping disks to SCSI interfaces
accordingly.

Any comment on this?

Andy

On 7/20/05, Maxim S. Shatskih wrote:
> Exactly. The load order of the miniports is what affects the hard disk
> numbering in Windows.
>
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
> ----- Original Message -----
> From: “Jinqiang Wang”
> To: “Windows System Software Devs Interest List”
> Sent: Tuesday, July 19, 2005 5:08 AM
> Subject: Re: [ntdev] How Windows NT/W2k determines hard disk number
>
>
> Hi Peter,
>
> I’m trying to record partition layout of all hard disks, and, when
> there is failure of any disk, I restore the partition layouts.
>
> Just think of this senario, I setup a system with one OEM SCSI adapter
> and a few disks. after that, I attach another SCSI adapter which
> driver is “in the box” with Widnows. If I try to reinstall Windows on
> this system, the disks attached to the SCSI adapter using retail
> driver will be recognized first and the I have to make a system
> partition on the first disk. I noticed that if the driver loaded first
> at setup time, disks attached to that SCSI adapter will be seen first.
>
> Any comment will be appreciate.
>
> Thanks,
>
> Andy
>
> On 7/19/05, Peter Wieland wrote:
> > Bios settings may or may not affect it. The ordering is not guaranteed
> > to be deterministic - you can’t assume that disk 0 is your boot disk or
> > even that it’s the same disk it was the last time the system booted.
> >
> > The better way to reference disks is using device interfaces. The
> > “path” that setupDI gives you back for a device’s interface is
> > persistant across boots (assuming the device isn’t moved to a different
> > bus address).
> >
> > What is it you want to do with this information?
> >
> > -p
> >
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Jinqiang Wang
> > Sent: Monday, July 18, 2005 12:21 AM
> > To: Windows System Software Devs Interest List
> > Subject: Re: [ntdev] How Windows NT/W2k determines hard disk number
> >
> > Prashant,
> >
> > Thanks for your reply.
> >
> > Does this sequence affected by BIOS settings? for example, if I set the
> > Slave disk on IDE channel 2 as the boot disk, and install Windows on it,
> > should this disk be harddisk0?
> >
> > Thanks,
> >
> > Andy
> >
> > On 7/18/05, Prashant Bhosale wrote:
> > > Disks are numbered sequentially as they are physically attached. But
> > > in case hot swapping, disks are not numbered sequentially, If you
> > > remove and reattach any disk then highest number is assigned.
> > >
> > > You can get the correct sequence using IOCTL_SCSI_GET_INQUIRY_DATA but
> >
> > > before that you have to rescan the bus using IOCTL_SCSI_RESCAN_BUS.
> > >
> > > -Prashant
> > >
> > >
> > > On 7/18/05, Jinqiang Wang wrote:
> > > >
> > > > Hi,
> > > >
> > > > On Windows NT/W2K, we can reference a specific hard disk by using
> > > > \Device\Harddiskx, where the ‘x’ is a zero-based number. Does anyone
> >
> > > > know how windows determines this number? Is there any rule for disks
> >
> > > > attached to IDE or SCSI controllers?
> > > >
> > > > Thanks,
> > > >
> > > > Andy
> > > >
> > > > —
> > > > Questions? First check the Kernel Driver FAQ at
> > > http://www.osronline.com/article.cfm?id=256
> > > >
> > > > You are currently subscribed to ntdev as: unknown lmsubst tag
> > argument: ‘’
> > > > To unsubscribe send a blank email to
> > > xxxxx@lists.osr.com
> > > >
> > >
> > > — Questions? First check the Kernel Driver FAQ at
> > > http://www.osronline.com/article.cfm?id=256 You are currently
> > > subscribed to ntdev as: unknown lmsubst tag argument: ‘’ To
> > > unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: unknown lmsubst tag argument:
> > ‘’
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
> —
> Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@gmail.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

I have the same comment I had before - disk “numbers” are not guaranteed
to remain the same from boot to boot - don’t use them to keep track of a
drive across reboots.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Andy Wang
Sent: Wednesday, July 20, 2005 7:16 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] How Windows NT/W2k determines hard disk number

Hi Maxim,

Thanks for your comments.

I noticed that the loader order of miniport drivers actually determines
the disk numbering. Another issus is that the tag value of miniport
drivers. If the OEM driver defines tag value, and this value precedes a
retail driver, then the disk numbering will be different during windows
text mode setup and during normal running mode. seems that this issue
can only be solved by mapping disks to SCSI interfaces accordingly.

Any comment on this?

Andy

On 7/20/05, Maxim S. Shatskih wrote:
> Exactly. The load order of the miniports is what affects the hard
> disk numbering in Windows.
>
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
> ----- Original Message -----
> From: “Jinqiang Wang”
> To: “Windows System Software Devs Interest List”
> Sent: Tuesday, July 19, 2005 5:08 AM
> Subject: Re: [ntdev] How Windows NT/W2k determines hard disk number
>
>
> Hi Peter,
>
> I’m trying to record partition layout of all hard disks, and, when
> there is failure of any disk, I restore the partition layouts.
>
> Just think of this senario, I setup a system with one OEM SCSI adapter

> and a few disks. after that, I attach another SCSI adapter which
> driver is “in the box” with Widnows. If I try to reinstall Windows on
> this system, the disks attached to the SCSI adapter using retail
> driver will be recognized first and the I have to make a system
> partition on the first disk. I noticed that if the driver loaded first

> at setup time, disks attached to that SCSI adapter will be seen first.
>
> Any comment will be appreciate.
>
> Thanks,
>
> Andy
>
> On 7/19/05, Peter Wieland wrote:
> > Bios settings may or may not affect it. The ordering is not
> > guaranteed to be deterministic - you can’t assume that disk 0 is
> > your boot disk or even that it’s the same disk it was the last time
the system booted.
> >
> > The better way to reference disks is using device interfaces. The
> > “path” that setupDI gives you back for a device’s interface is
> > persistant across boots (assuming the device isn’t moved to a
> > different bus address).
> >
> > What is it you want to do with this information?
> >
> > -p
> >
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Jinqiang Wang
> > Sent: Monday, July 18, 2005 12:21 AM
> > To: Windows System Software Devs Interest List
> > Subject: Re: [ntdev] How Windows NT/W2k determines hard disk number
> >
> > Prashant,
> >
> > Thanks for your reply.
> >
> > Does this sequence affected by BIOS settings? for example, if I set
> > the Slave disk on IDE channel 2 as the boot disk, and install
> > Windows on it, should this disk be harddisk0?
> >
> > Thanks,
> >
> > Andy
> >
> > On 7/18/05, Prashant Bhosale wrote:
> > > Disks are numbered sequentially as they are physically attached.
> > > But in case hot swapping, disks are not numbered sequentially, If
> > > you remove and reattach any disk then highest number is assigned.
> > >
> > > You can get the correct sequence using IOCTL_SCSI_GET_INQUIRY_DATA

> > > but
> >
> > > before that you have to rescan the bus using
IOCTL_SCSI_RESCAN_BUS.
> > >
> > > -Prashant
> > >
> > >
> > > On 7/18/05, Jinqiang Wang wrote:
> > > >
> > > > Hi,
> > > >
> > > > On Windows NT/W2K, we can reference a specific hard disk by
> > > > using \Device\Harddiskx, where the ‘x’ is a zero-based number.
> > > > Does anyone
> >
> > > > know how windows determines this number? Is there any rule for
> > > > disks
> >
> > > > attached to IDE or SCSI controllers?
> > > >
> > > > Thanks,
> > > >
> > > > Andy
> > > >
> > > > —
> > > > Questions? First check the Kernel Driver FAQ at
> > > http://www.osronline.com/article.cfm?id=256
> > > >
> > > > You are currently subscribed to ntdev as: unknown lmsubst tag
> > argument: ‘’
> > > > To unsubscribe send a blank email to
> > > xxxxx@lists.osr.com
> > > >
> > >
> > > — Questions? First check the Kernel Driver FAQ at
> > > http://www.osronline.com/article.cfm?id=256 You are currently
> > > subscribed to ntdev as: unknown lmsubst tag argument: ‘’ To
> > > unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: unknown lmsubst tag
argument:
> > ‘’
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: unknown lmsubst tag
argument: ‘’
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: unknown lmsubst tag
argument: ‘’
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@gmail.com To
> unsubscribe send a blank email to xxxxx@lists.osr.com
>


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument:
‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

Thank you Peter. I did some test using Windows ASR, seems it is much
smarter. it can restore the partition layout onto correct disk even
the driver load order changes. obviously the ASR.SIF does all the
booking work, but I still don’t know what’s the meaning of [buses]
section. I think I need to dig into this a little deeper.