VirtualBox

Opened 13 years ago

Last modified 5 years ago

#8760 reopened defect

VMDK: VERR_SHARING_VIOLATION

Reported by: Alaric Owned by:
Component: virtual disk Version: VirtualBox 4.0.6
Keywords: VERR_SHARING_VIOLATION Windows7 rawdisk physicaldrive Cc:
Guest type: Linux Host type: Windows

Description (last modified by aeichner)

When running in an administrator command line and attempting to create virtual drives from raw disks under a windows 7 host, vboxmanage fails with this error message. I was previously able to use these commands to mount my ubuntu partition under virtualbox on a windows XP host.

Regards, Alaric

C:\Program Files\Oracle\VirtualBox>VBoxManage.exe internalcommands listpartition s -rawdisk \.\PhysicalDrive0 Number Type StartCHS EndCHS Size (MiB) Start (Sect) 5 0x83 0 /2 /1 29 /254/63 235 126 6 0x82 30 /1 /1 333 /254/63 2384 482013 7 0x83 334 /1 /1 1023/254/63 18119 5365773 8 0x83 1023/254/63 1023/254/63 17406 42475520 2 0x07 1023/254/63 1023/254/63 114470 78124095

C:\Program Files\Oracle\VirtualBox>VBoxManage.exe internalcommands createrawvmdk

-filename "c:\Users\alaric\mydrive.vmdk" -rawdisk \.\PhysicalDrive0 -partition

s 5,6,7,8 VBoxManage.exe: error: VMDK: could not open raw partition file '\.\PhysicalDriv e0' VBoxManage.exe: error: Error code VERR_SHARING_VIOLATION at D:\tinderbox\win-4.0 \src\VBox\Storage\VMDK.cpp(3762) in function vmdkCreateRawImage VBoxManage.exe: error: Cannot create the raw disk VMDK: VERR_SHARING_VIOLATION VBoxManage.exe: error: The raw disk vmdk file was not created

Attachments (2)

vbox-fail.txt (1.0 KB ) - added by Alaric 13 years ago.
Log file showing the createrawvmdk error
vbox-vmdk-raw-access-fail.txt (2.2 KB ) - added by Jonathan 12 years ago.

Download all attachments as: .zip

Change History (21)

by Alaric, 13 years ago

Attachment: vbox-fail.txt added

Log file showing the createrawvmdk error

comment:1 by Chris Johnson, 13 years ago

I can confirm this error on Windows 7. This is a real problem for me because I have a web server that needs to stay up running in Windows, but I need to do some work in Ubuntu. However, it's currently completely broken.

Base command output:

c:\Program Files\Oracle\VirtualBox>VBoxManage internalcommands createrawvmdk -filename C:\ubuntu.vdmk -rawdisk \.\PhysicalDrive0
VBoxManage.exe: error: Cannot open the raw disk '\.\PhysicalDrive0': VERR_SHARING_VIOLATION
VBoxManage.exe: error: The raw disk vmdk file was not created

With my partition options:

c:\Program Files\Oracle\VirtualBox>VBoxManage internalcommands createrawvmdk -fi
lename C:\Users\Michael\Documents\ubuntu.vmdk -rawdisk \.\PhysicalDrive0 -partitions 2,5
VBoxManage.exe: error: Cannot open the raw disk '\.\PhysicalDrive0': VERR_SHARING_VIOLATION
VBoxManage.exe: error: The raw disk vmdk file was not created

So yeah, raw disk access is totally broken, and it seems that it has been now for over a year since the defect resurfaced: http://www.virtualbox.org/ticket/919

comment:2 by VitRom, 12 years ago

The same happens on every VB versions including 4.1.4
with any of the "raw"-class commands on PhysicalDrive0,
even with absolutely safe (for any healthy mind) listpartitions

C:\Program Files\Oracle\VirtualBox>VBoxManage internalcommands  -rawdisk \.\PhysicalDrive0
VBoxManage.exe: error: Cannot open the raw disk: VERR_SHARING_VIOLATION

in reply to:  1 comment:3 by Jonathan, 12 years ago

Replying to Javaguru:

I can confirm this error on Windows 7. This is a real problem for me because I have a web server that needs to stay up running in Windows, but I need to do some work in Ubuntu. However, it's currently completely broken.

I was also happily using my Ubuntu VM on a Windows 7 host (I had to run VirtualBox as admin), using a VMDK image pointing at a raw EXT4 partition on disk, until it stopped working around June 2011. I don't know whether that was because of a Microsoft security update where they may have changed the access level around raw disk access (perhaps to counter Ring 0 exploits) or whether it was an update of VirtualBox that has stopped working. Pertinent bits from the log attached.

Attempts from both user and admin prompts to re-create the raw disk access VMDK image or even just to run listpartitions now result in:

C:\Program Files\Oracle\VirtualBox>VBoxManage internalcommands listpartitions -rawdisk \.\PhysicalDrive1 VBoxManage.exe: error: Cannot open the raw disk: VERR_SHARING_VIOLATION

Which used to execute successfully before.

by Jonathan, 12 years ago

comment:4 by aeichner, 11 years ago

Component: VMM/RAWvirtual disk
Description: modified (diff)

comment:5 by Christian Rilke, 9 years ago

I can confirm this problem. I tried the listpartitions command from administrator command line.

C:\Program Files\Oracle\VirtualBox>VBoxManage.exe internalcommands listpartitions -rawdisk \\.\PhysicalDrive0
VBoxManage.exe: error: Cannot open the raw disk: VERR_SHARING_VIOLATION

Is there any workaround for that?

I tried this with 4.3.26 AND 5.0.0_BETA2r99573

comment:6 by Christian Rilke, 9 years ago

This bug still exists in version 4.3.28 r100309.

C:\Program Files\Oracle\VirtualBox>VBoxManage.exe internalcommands createrawvmdk -filename "C:\Users\CR\Documents\Virtual Machines\LinuxRAW.vmdk" -rawdisk "\\.\PhysicalDrive0" -partitions 3,4,5
VBoxManage.exe: error: Cannot open the raw disk '\\.\PhysicalDrive0': VERR_SHARING_VIOLATION
VBoxManage.exe: error: The raw disk vmdk file was not created

Disk0 ist the disk Windows and VirtualBox running from but from diffrent partitions.

comment:7 by aeichner, 9 years ago

Resolution: fixed
Status: newclosed

With 5.0 it is possible to just specify the partitions required instead of the complete physical drive, see #14268. All remaining issues should go there.

comment:8 by omk33, 8 years ago

Resolution: fixed
Status: closedreopened

The same happens on VB versions 5.0.12

C:\Users\1>"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" internalcommands createrawvmdk -filename "C:\Users\1\VirtualBox VMs\1\drive.vmdk" -rawdisk
.\PHYSICALDRIVE9 VBoxManage.exe: error: Cannot open the raw disk '
.\PHYSICALDRIVE9': VERR_SHARING_VIOLATION VBoxManage.exe: error: The raw disk vmdk file was not created

C:\Users\1>"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" internalcommands createrawvmdk -filename "C:\Users\1\VirtualBox VMs\1\drive.vmdk" -rawdisk
.\PHYSICALDRIVE9 -pa rtitions 1,2,3,4 VBoxManage.exe: error: Cannot open the raw disk '
.\PHYSICALDRIVE9': VERR_SHARING_VIOLATION VBoxManage.exe: error: The raw disk vmdk file was not created

Last edited 8 years ago by omk33 (previous) (diff)

comment:9 by VarunAgw, 8 years ago

Can confirm! VM have stopped working properly since the update.

comment:10 by Passacaglia72, 8 years ago

Same error exists in 5.0.14, and this was working before I recently updated.

Also, my raw disk access using a vmdk file created successfully with an earlier version (and working with that version), had stopped working with my VM running under 5.0.14. Uncertain of the problem, I deleted the original .vmdk and have attempted to recreate it, which fails with the problem described in this thread.

comment:11 by brexit, 8 years ago

  • Windows 10 x64, VirtualBox 5.0.22
  • FreeBSD x64 based OVA file

=============================================

Failed to import appliance C:\Users\user\Downloads\my.ova.

Could not open the medium storage unit 'C:\Users\user\VirtualBox VMs\my\temp_my-disk1.vmdk.gz'.

VD: error VERR_SHARING_VIOLATION opening image file 'C:\Users\user\VirtualBox VMs\my\temp_my-disk1.vmdk.gz' (VERR_SHARING_VIOLATION).

Result Code: VBOX_E_FILE_ERROR (0x80BB0004) Component: ApplianceWrap Interface: IAppliance {8398f026-4add-4474-5bc3-2f9f2140b23e}

comment:12 by sbpetrack, 7 years ago

Still broken on VB 5.1.8 (for Win x64 host) -- broken for both listpartitions and createrawvmdk -- broken for both full raw disk access and access restricted with the -partitions parameter -- broken whether or not -relative is specified

uninstalling and reinstalling VM doesn't help

so raw disk access for windows hosts is just non-existent in the current builds

comment:13 by noillagrn, 7 years ago

Also experiencing this issue. Doesn't seem to be any way to follow this ticket without adding a comment (hence this comment.)

comment:14 by cblackburn, 7 years ago

I too am having this issue with Windows 10 X64 Pro. I get this error from an admin command prompt. "VBoxManage internalcommands listpartitions -rawdisk
.\PhysicalDrive2" The first partition is in use, but the second I removed the drive letter so I could use it directly with my Linux Mint 17.2 x64 vm (both are NTFS partitions and part of a Intel Rapid Storage Technology, aka Motherboard RAID, RAID array).

comment:15 by Pysis, 6 years ago

Also having the issue, Windows 10 Pro 64-bit, using cmd as Administrator:

VBoxManage internalcommands listpartitions -rawdisk
.\PhysicalDrive4 VBoxManage.exe: error: Cannot open the raw disk: VERR_SHARING_VIOLATION

I have been using the rawvmdk for a while to access a USB drive, and also boot from it using a VM, but I was unable to since about 4-6 months ago. I was usually using VirtualBox 5.1.26, or maybe down to .20?

I get this for all of my drives, even the one that used to work. It was also just freshly inserted. Sometimes I would gets this error when leaving it plugged in for a while, maybe through sleeps or otherwise of the computer, but re-inserting it would fix the problem. I believe that was also this VERR_SHARING_VIOLATION problem as well, but I Could be confusing it with a commonly paired error that I see further along when actually trying to start the VM with that drive connected, running VirtualBox as Administrator of course.

comment:16 by JonnyAsmar, 6 years ago

The issue here actually isn't VirtualBox. Unfortunately, Intel runs some processes that latch onto your disk, even if you unmount it.

I discovered the solution to this on the VirtualBox forums:

https://forums.virtualbox.org/viewtopic.php?f=6&t=58793#p273296

See TechMedicNYC's suggestion to use Process Explorer to unbind some Intel services from your disk; worked like a charm for me!

comment:17 by croddy, 5 years ago

This seems to be impenetrable on Windows 10 (Pro, 1803) with Virtualbox 6.0.4. It does not matter whether the disks are set to online or offline in the disk management utility; the listpartitions and createrawvmdk commands always result in VERR_SHARING_VIOLATION.

Note that this is when running VBoxManage as Administrator - with another account, it is VERR_ACCESS_DENIED.

I followed JohnnyAsmar's suggestion to look for processes with file handles on the disks in question and there are none. The only such handles open were for a different physical disk (the one hosting the Windows installation itself).

Last edited 5 years ago by croddy (previous) (diff)

comment:18 by Socratis, 5 years ago

To paraphrase the post from https://forums.virtualbox.org/viewtopic.php?f=6&t=38914#p175089 with a real-life example, where the boot disk is "Disk 1" and rawdisk access is required for "Disk 0":

C:\Windows\system32>diskpart

DISKPART> list disk
  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online          232 GB      0 B
  Disk 1    Online          279 GB  1024 KB            <-- Mind you, THIS is my boot disk,
  Disk 2    Online          372 GB      0 B                 Disk 1, not Disk 0. Careful!!!
  Disk 3    Online          931 GB      0 B

DISKPART> select disk 0
Disk 0 is now the selected disk.

DISKPART> offline disk
DiskPart successfully offlined the selected disk.

DISKPART> list disk
  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Offline         232 GB      0 B
  Disk 1    Online          279 GB  1024 KB
  Disk 2    Online          372 GB      0 B
  Disk 3    Online          931 GB      0 B

DISKPART> attributes disk clear readonly
Disk attributes cleared successfully.

DISKPART> exit
Leaving DiskPart...

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 can create your VMDK...

in reply to:  17 comment:19 by Socratis, 5 years ago

Replying to croddy:

This seems to be impenetrable on Windows 10 (Pro, 1803) with Virtualbox 6.0.4. It does not matter whether the disks are set to online or offline in the disk management utility; the listpartitions and createrawvmdk commands always result in VERR_SHARING_VIOLATION.

Note that this is when running VBoxManage as Administrator - with another account, it is VERR_ACCESS_DENIED.

To add to my previous comment, 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...

Note: See TracTickets for help on using tickets.

© 2023 Oracle
ContactPrivacy policyTerms of Use