Page 1 of 1
Raw VMDK using disk ID
Posted: 20. Apr 2021, 09:17
by pderocco
I'm running a Win7 guest under a Win10 host, and it's using a VMDK that refers to an entire physical drive as "\\.\PhysicalDrive2". Sometimes this path changes. Is there a way to reference the drive by some fixed id in Windows? I've found descriptions of how to do this on a Linux host, but not in Windows. There is a 32-bit id that can be retrieved by the diskpart "uniqueid disk" command, but is there a way to refer to a disk by that id in the vmdk file?
Re: Raw VMDK using disk ID
Posted: 20. Apr 2021, 14:17
by scottgus1
pderocco wrote:Sometimes this path changes. Is there a way to reference the drive by some fixed id in Windows?
Unfortunately, no, not on Windows. Thus the expert status of Raw Disk Access. You need to check that number each time lest the wrong disk gets used.
There may be (and I believe there is) some unique UUID or other such number for each drive accessible through a Diskpart script or WMI search that can cross-tabulate each disk's UUID and physical disk number. A VBscript could be made to gather the information, determine the correct physical disk number, then write the raw disk access file before starting the VM.
Re: Raw VMDK using disk ID
Posted: 20. Apr 2021, 20:31
by pderocco
Is there a way to invoke such a script or program from the .vbox file?
Re: Raw VMDK using disk ID
Posted: 20. Apr 2021, 20:33
by scottgus1
No, it would only be from a batch file or shortcut. Virtualbox does not have a setting for running a script before starting the VM, though that could be a useful addition.
You'd have to be careful to use the script to start the VM, not the main Virtualbox window.