Cygwin: Associate Windows 7 disk number with physical location

0

Question:

Is is possible from Cygwin (Windows 7) to discover the disk "Location" (in this case specific SATA port) given only the Windows disk number, e.g. "Disk 1" is on SATA channel 3.

Background:

I am using VirtualBox on a Windows host and giving the guest direct access to host hard drives (unused by Windows). The drives are attached in a specific order to the guest using the VB rawdisk magic: https://www.virtualbox.org/manual/ch09.html#rawdisk

Windows likes to move disks around. That is, the disk number does not always correspond to the physical SATA channel the disk is connected to. For the rawdisk magic to work, the Windows disk number needs to be passed to VBoxManage. However because of the way this is all set up, I need a specific disk to map to a specific device number on the guest. I know the SATA channel of each disk, but need to correlate the Windows disk number to the SATA channel its connected to.

Using Windows' "Computer Management" under the "Disk Management" tab, it's possible to right click on a disk number, and in properties, the "Location" is the physical SATA port. While it rarely changes, sometimes it does, and I need to rerun the rawdisk commands for each of the 5 disks I pass to the guest OS. I would like to script all of this away so a single command can recreate all of the rawdisk vmdk files that are ordered and named properly.

Kris Bahnsen

Posted 2018-02-08T20:49:24.447

Reputation: 149

Is readom.exe --scanbus output what are you looking for ? (it is in wodim package) – matzeri – 2018-02-09T06:21:15.540

@matzeri Thats a good start, but for HDDs does not list any information I can use to correlate to Windows disk numbering.

scsibus0: 0,0,0 0) * 0,1,0 1) * 0,2,0 2) * 0,3,0 3) * 0,4,0 4) * 0,5,0 5) * 0,6,0 6) *

I have also found /proc/partitions, and /proc/sys/ArcName. The partitions file shows Windows disk numbering. ArcName is unfortunately not something I was able to correlate to "Location" or Windows disk numbering, but it seemed to have that potential. EDIT: Sorry the formatting sucks. – Kris Bahnsen – 2018-02-09T07:51:44.230

No answers