VERR_SHARING_VIOLATION When Creating Raw Disk

Discussions related to using VirtualBox on Windows hosts.
Post Reply
Tuxter
Posts: 1
Joined: 17. Aug 2018, 01:59

VERR_SHARING_VIOLATION When Creating Raw Disk

Post by Tuxter »

Hi,

I'm trying to create a raw disk with the standard command. Even when I try to list the partitions, I get the following.

Code: Select all

C:\Program Files\Oracle\VirtualBox>VBoxManage.exe internalcommands listpartitions -rawdisk \\.\PhysicalDrive1
VBoxManage.exe: error: Cannot open the raw disk: VERR_SHARING_VIOLATION
I've run it in an administrative command prompt. I've tried with the disk online and offline. There are currently no partitions on it. I've tried both GPT and MBR partition tables. I'm really not sure what else to try.

Any ideas?
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: VERR_SHARING_VIOLATION When Creating Raw Disk

Post by socratis »

To begin with, you're going to get an error in any event, either being Administrator or a SimpleUser. It's the error that differs:
Admin>VBoxManage internalcommands listpartitions -rawdisk \\.\PhysicalDrive0
VBoxManage.exe: error: Cannot open the raw disk: VERR_SHARING_VIOLATION

SimpleUser>VBoxManage internalcommands listpartitions -rawdisk \\.\PhysicalDrive0
VBoxManage.exe: error: Cannot open the raw disk: VERR_ACCESS_DENIED
The VERR_SHARING_VIOLATION comes up because a running process in the host is using the hard disk. You'll need to "release" it. Use the "Process Explorer" from SysInternals to see who's responsible for that. You could actually download the whole SysInternals Suite, invaluable set of tools.

In my case, I enabled the Admin mode (menu "File" » "Show Details for All Processes") and I used the menu "Find" » "Find Handle or DLL..." » "HardDisk0", and out comes OpenHardwareMonitor (to monitor the HDs temperatures, cool little tool but interfering at the moment). Exit OpenHardwareMonitor, and:
Admin>VBoxManage internalcommands listpartitions -rawdisk \\.\PhysicalDrive0
Number  Type   StartCHS       EndCHS      Size (MiB)  Start (Sect)
1       0x07  0   /1  /1   1023/254/63        238475           63
Now, you could create your VMDK...

PS. No, it's not a typo, my PhysicalDrive0 is not my boot disk, PhysicalDrive1 is.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Post Reply