How to mount a raw/real SATA partition on virtual machine

Discussions related to using VirtualBox on Linux hosts.
Post Reply
Padre
Posts: 6
Joined: 23. Feb 2016, 02:34

How to mount a raw/real SATA partition on virtual machine

Post by Padre »

Can't quite get this. I created a vmdk that points to my disk partition with the command
* sudo vboxmanage internalcommands createrawvmdk -filename "linux-32-1-root3.vmdk" -rawdisk /dev/sda2
This gives me a vmdk that looks OK, but is owned by root, but that is the only way I can get the command to work.
I have tried chmod & chown in every way I can think of but when I try to add it to my VM I get the following error;

* Failed to open the hard disk file /home/wix/linux-32-1-root3.vmdk.
* Permission problem accessing the file for the medium '/home/wix/linux-32-1-root3.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)

I'm running a fresh install of VB 4.3.36 on a fresh install of Debian 8.3.0 Jessie

Does anybody have an solution for this?

Many TIA!
Padre
Posts: 6
Joined: 23. Feb 2016, 02:34

Re: How to mount a raw/real SATA partition on virtual machin

Post by Padre »

Update: Installed VB 5.0.14 -- No difference
* Changed permissions to 777 -- no difference.
* Changed ownership to me:vboxusers -- no difference.
Martin
Volunteer
Posts: 2562
Joined: 30. May 2007, 18:05
Primary OS: Fedora other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: XP, Win7, Win10, Linux, OS/2

Re: How to mount a raw/real SATA partition on virtual machin

Post by Martin »

You shouldn't need to use sudo if your user is a member of the right group for disk access.
What are the access rights for /dev/sda2?
Padre
Posts: 6
Joined: 23. Feb 2016, 02:34

Re: How to mount a raw/real SATA partition on virtual machin

Post by Padre »

When I do an ls on /dev/sda2 it shows 660 root:disk.
Is that what you mean?

copy&paste of ls -la: brw-rw---- 1 root disk 8, 2 Feb 23 10:29 /dev/sda2
Martin
Volunteer
Posts: 2562
Joined: 30. May 2007, 18:05
Primary OS: Fedora other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: XP, Win7, Win10, Linux, OS/2

Re: How to mount a raw/real SATA partition on virtual machin

Post by Martin »

Is your user account a member of the "disk" group?
Padre
Posts: 6
Joined: 23. Feb 2016, 02:34

Re: SOLVED How to mount a raw/real SATA partition on virtual

Post by Padre »

I put my user in the disk group, and specified the entire pathname from root where the vmdk file would be
created and the create command worked with no sudo prefix. And the vmdk files attached to the VM with no complaints!

Now I need to find out how to remove all the vmdk files that don't work and how to specify a boot device for the VM!

Thanks for the pointers! Got me on the right track!!
Post Reply