How can I run Windows in a VM using VirtualBox? My image is always permission denied I'm attempting to run a Bootcamp partition in a virtual machine using VirtualBox.  It's a Windows 10 install with latest Bootcamp drivers (which I guess is irrelevant here) and latest version of VirtualBox.

I have created a .vmdk file from my partition using the following command:

$ sudo VBoxManage internalcommands createrawvmdk -filename "windows.vmdk" -rawdisk /dev/disk0s3

This created my file successfully.  When I then create my VM using this file as my virtual hard drive I get the following error from within VirtualBox:

Failed to open a session for the virtual machine Win10.

VD: error VERR_NOT_SUPPORTED opening image file '/Users/mike/windows.vmdk' (VERR_NOT_SUPPORTED).

VD: error VERR_ACCESS_DENIED opening image file '/Users/mike/windows.vmdk' (VERR_ACCESS_DENIED).

Failed to open image '/Users/mike/windows.vmdk' in read-write mode (VERR_ACCESS_DENIED).

AHCI: Failed to attach drive to Port0 (VERR_ACCESS_DENIED).

Result Code: NS_ERROR_FAILURE (0x80004005)
Component: ConsoleWrap
Interface: IConsole {872da645-4a9b-1727-bee2-5585105b9eed}


I have also done the following:


chmod 0777 windows.vmdk
chown mike:staff windows.vmdk
sudo chmod 0777 /dev/disk0s3 (my bootcamp partition)
I've even tried chown mike:staff /dev/disk0s3


There are a few posts online that suggest ticking the Use Host I/O Cache box under the Storage area of the VirtualBox GUI.  Doing this doesn't error VirtualBox, but just gives me a black screen stating:

A disk readerror occurred
Press Ctrl+Alt+Del to restart

I'd imagine running a VM from a partition is a reasonably common use-case, so would appreciate any help.  I'm on MacOS 10.14 (Mojave).
Most users wishing to do what you want to do purchase VM Fusion or Parallels.

VirtualBox is not really designed for what you are trying to do. Think of what would happen if you were to clone your Windows partition to another entirely different PC. You should not expect Windows to boot because you did not copy any boot code to the new PC. If you were to fix this problem, then you should expect there to be problems with the fact that the hardware peripherals would be different. I suppose you could have generalized Windows before the copy, then installed new drivers after booting Windows on the new PC, but generalization was not meant to be performed after Windows is in use. Anyway, this what you are attempting to do by booting a Boot Camp install of Windows in VirtualBox.

Below are some items you may need to worry about.


You have no boot code. You can use the Windows ISO file to create boot code, but the procedure depends on whether you are going to BIOS or EFI boot.
You have not mentioned if VirtualBox is set to boot the same way. In other words, will you need to BIOS or EFI boot in VirtualBox?
You may need to run "C:\Windows\System32\sysprep" to generalize before booting in VirtualBox. 


I assume you entered the commands given below.

sudo VBoxManage internalcommands createrawvmdk -filename "windows.vmdk" -rawdisk /dev/disk0s3
sudo chown mike:staff windows.vmdk


I would have entered the commands given below.

sudo vboxmanage internalcommands createrawvmdk -filename "windows.vmdk" -rawdisk  /dev/disk0 -partitions 3
sudo  chown  $USER  windows*.vmdk



  Note: You will need to enter the command diskutil unmount disk0s3 immediately before starting the virtual machine.