Page 1 of 1
Same hardware id for Disk device
Posted: 23. Feb 2019, 09:19
by Finix
Hi,
I have a windows 10 guest OS and assigned two disks to this guest on Mac host. When I open the registry HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Disk\Enum, there are two disks with same ID. And in disk property dialog, it also show same hardware ID for these two disk.
I wonder to know how Windows OS identify these same id disks are not same one, especially in multiple path environment.
Thank you.
Re: Same hardware id for Disk device
Posted: 23. Feb 2019, 10:56
by socratis
Finix wrote:When I open the registry HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Disk\Enum, there are two disks with same ID
That's the "brand" of the physical hard disk maker. For example, on my physical Win host, I have:
[quote]
IDE\DiskST3300831AS_____________________________3.03____\5&14fac76c&0&2.0.0
IDE\DiskWDC_WD10EAVS-00M4B0_____________________01.00A01\5&3a6e28b6&0&0.0.0
IDE\DiskWDC_WD2500KS-00MJB0_____________________02.01C03\5&24116c7&0&3.0.0
[/quote]
That's #1 a Seagate and #2, #3 two Western Digital hard drives. On a similar Win VM, I get the maker of the virtual hard drive; VirtualBox:
[quote]
SCSI\Disk&Ven_VBOX&Prod_HARDDISK\4&2617aeae&0&000000
SCSI\Disk&Ven_VBOX&Prod_HARDDISK\4&2617aeae&0&000000
IDE\DiskVBOX_HARDDISK___________________________1.0_____\5&394c0ad3&0&0.0.0
[/quote]
That's two SATA and one IDE (just for variety). The manufacturer and the model are exactly the same, obviously.
Finix wrote:I wonder to know how Windows OS identify these same id disks are not same one, especially in multiple path environment.
By the way you have them connected; Primary/Secondary Master/Slave for IDE drives, Port# for SATA/SCSI. Just like on a physical computer...
Re: Same hardware id for Disk device
Posted: 23. Feb 2019, 14:48
by Finix
Thanks for your information.
Another question is about how to identify virtual box guest OS disk devices. Currently my driver code assemble an unique ID string for each disk device and this ID is almost same as what shows in windows registry above. It works fine in other hypervisor and always could distinguish different gust disks. But in virtualbox environment, it seems the disk id are same. Do you have any advice? Thank you.
Re: Same hardware id for Disk device
Posted: 23. Feb 2019, 15:15
by socratis
Finix wrote:Do you have any advice?
No, not really...
But I can tell you one thing; you're looking at the wrong key. This is the hard disk manufacturer/product. If you stick two identical hard drives in your host, you won't be able to tell them apart just by looking at that key alone. You'd need to look elsewhere for unique identification (if the order is not differentiating enough for you).
Don't ask me where, I have no clue. And I'm not about to start searching...

Re: Same hardware id for Disk device
Posted: 23. Feb 2019, 15:50
by andyp73
If you want to uniquely identify an ATA compliant disk device then you have to use its serial number. You'll need to look at the API calls for your OS to send each disk an "IDENTIFY PACKET DEVICE" command the response from which includes the serial number. You can probably save yourself sometime as most OS will do that already as part of the boot process and the information will be stored somewhere accessible (in Windows somewhere in the registry under HKLM).
If you want to get truly down and dirty then I would suggest getting yourself a copy of the ATA Command Set Specification document.
-Andy.