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
>