Ubuntu – Virtualbox doesn’t work with a real partition

virtualboxwindows 7

So I followed the instructions here. However, when I went to Virtualbox and told it to use the file I got the error

Failed to open the hard disk file /home/parth/Win7.vmdk.

Permission problem accessing the file for the medium '/home/parth/Win7.vmdk' (VERR_ACCESS_DENIED).

Result Code: VBOX_E_FILE_ERROR (0x80BB0004)

Component: Medium

Interface: IMedium {05f2bbb6-a3a6-4fb9-9b49-6d0dda7142ac}

Callee: IVirtualBox {fafa4e17-1ee2-4905-a10e-fe7c18bf5554}

Callee RC: VBOX_E_OBJECT_NOT_FOUND (0x80BB0001)

Best Answer

The VirtualBox user should be the owner of .vmdk file and have read & write permissions for both .vmdk and the device it refers to (like /dev/sda). Everything in /dev/ is owned by root, so you have two options:

  1. Run VirtualBox as root. I wouldn't suggest it because such a huge application as VirtualBox potentially have bugs that are capable to crash your system being rooted.

  2. Grant your user the permissions for the .vmdk file and the /dev/sdX device:

    a. Make sure .vmdk is somewhere in your home directory

    b. Make sure that your user is the owner of .vmdk and have read and write permissions for it (right click -> Properties -> Permissions)

    c. Grant your user the permissions for the device:

    sudo chmod 666 /dev/sdX

    (place the required device instead of /dev/sdX)