Page 1 of 1
How can I use physical partitions for my VMs?
Posted: 20. Aug 2011, 19:44
by sonnet
I have created following the manual a vmdk (actually they are 2) files necessary with the command
VBoxManage internalcommands createrawvmdk -filename /path/to/file.vmdk
-rawdisk /dev/sda -partitions 1,5
As said it created 2 files for the partition I intend to dedicate to my new vm.
One is vm02.vmdk (vm02 is the name i have given) and the second is vm02-pt.vmdk.
Now when I'm into the wizard to create a new machine I try to assign (i select "use existing disk" OPTION) partition I intend to dedicate by selecting one of those 2 .vmdk files
but I get an error message when doing that.
Can anyone tell me what am I doing wrong?
Host OS: Ubuntu 11.04 64bit.
Guest: is that relevant in this case? Since I'm doing it from the VB manager shouldn't be relevant I guess and I'm trying to assign teh disk when creating a new VM. Anyway it's supposed to be Windows 7
My user is in the vbox users, and both my account and the vboxuser group have full permission on the partition (I tried it also with the partition unmounted just to check)
This is the error I get when selecting vm02.vmdk

Re: How can I use physical partitions for my VMs?
Posted: 20. Aug 2011, 19:55
by Sasquatch
Would be useful if you updated your profile with Host, Guest and version information. It's also very useful if you gave the actual error. Since RAW Disk needs direct access to the hard drive, you have to either be root or be in the Disk group (both are quite dangerous privileges when used without proper care!).
Re: How can I use physical partitions for my VMs?
Posted: 20. Aug 2011, 20:53
by sonnet
Sasquatch wrote:Would be useful if you updated your profile with Host, Guest and version information. It's also very useful if you gave the actual error. Since RAW Disk needs direct access to the hard drive, you have to either be root or be in the Disk group (both are quite dangerous privileges when used without proper care!).
yes, sorry I provided the informations requested. I think I'm doing some stupid mistake but I can't figure it out what's the mistake.
Re: How can I use physical partitions for my VMs?
Posted: 20. Aug 2011, 22:28
by Sasquatch
And the user privileges? Do you have the proper ones or did you not change anything to your account or how you run VB?
Re: How can I use physical partitions for my VMs?
Posted: 21. Aug 2011, 10:39
by sonnet
Sasquatch wrote:And the user privileges? Do you have the proper ones or did you not change anything to your account or how you run VB?
My user has read&write access to the /media/VM02 folder (which represents the partition I intend to use directly for my VM) and also vboxuser group (which my user is part of) has the same access.
Is that enough, or should I do something more than that?
Re: How can I use physical partitions for my VMs?
Posted: 21. Aug 2011, 14:31
by Sasquatch
Having access to /media/VM02 does not matter. If you have the partition mounted, things can blow up in your face. That's clearly written in the manual. If you ignore it, you don't have to come crying here when you corrupted your partition.
Since you don't exactly know what you need to do, I strongly advise you to abandon this idea and stick to using VDI files.
Re: How can I use physical partitions for my VMs?
Posted: 21. Aug 2011, 16:02
by sonnet
But I have already wrote above that I tried with the partition unmounted too...
It's not a question of knowing what to do. It's a fact that's not written clearly what to do in the manual (which I read)
Re: How can I use physical partitions for my VMs?
Posted: 21. Aug 2011, 17:15
by Perryg
VBoxManage internalcommands createrawvmdk -filename /path/to/file.vmdk -rawdisk /dev/sda -partitions 1,5
Several mistakes that I see off the bat. DO you really have 5 partitions on this drive and is partition 5 where you want this to reside? But the biggest thing is the 1 which is more than likely the partition that houses your root. It is clearly stated not to do this since that is the partition that your host is running from. Have you read Chapter 9.8 Advanced storage configuration really well and all of the sub chapters? Also the "/path/to/file.vmdk" is that what you typed or is that just an example you show.
Re: How can I use physical partitions for my VMs?
Posted: 21. Aug 2011, 20:51
by sonnet
Perryg wrote:VBoxManage internalcommands createrawvmdk -filename /path/to/file.vmdk -rawdisk /dev/sda -partitions 1,5
Several mistakes that I see off the bat. DO you really have 5 partitions on this drive and is partition 5 where you want this to reside? But the biggest thing is the 1 which is more than likely the partition that houses your root. It is clearly stated not to do this since that is the partition that your host is running from. Have you read Chapter 9.8 Advanced storage configuration really well and all of the sub chapters? Also the "/path/to/file.vmdk" is that what you typed or is that just an example you show.
No ..that was just to show the syntax I used. the actual command is (I didn't want to show my username that's why I used the example) :
VBoxManage internalcommands createrawvmdk -filename /home/pip/Virtuabox/vm02.vmdk -rawdisk /dev/sdc -partitions 1
If the command I used above was wrong, I guess I have had some error showed in the terminal and/or the 2 .vmdk file not generate.
What I'd like to know from the ones who successfully mounted physical partitions into their VM is:
After I gave the command for the partition into the terminal and it generates the 2 .vmdk file (after I gave the command I found created vm02-part.vmdk and vm02.vmdk) should I do anything else than trying to add the .vmdk file (I tried with the -part.vmdk too)
to the Virtual Machine?
Re: How can I use physical partitions for my VMs?
Posted: 20. Sep 2011, 13:44
by dpolshaw
Anything further on this problem - I have the same issue. Partition 1 of sdb is not mounted in the Host OS. I have tried changing the permissions of sdb1, sdb and all other partitions to 666 and still it will not let me use the vmdk on the VM BedroomXP1
Command to create the vmdk
VBoxManage internalcommands createrawvmdk -filename /home/dave/data.vmdk -rawdisk /dev/sdb -partitions 1
Error when I try to use it -
Failed to open the hard disk /home/dave/data.vmdk.
The medium '/home/dave/data.vmdk' can't be used as the requested device type.
Result Code: NS_ERROR_FAILURE (0x80004005)
Component: Medium
Interface: IMedium {53f9cc0c-e0fd-40a5-a404-a7a5272082cd}
Callee: IVirtualBox {c28be65f-1a8f-43b4-81f1-eb60cb516e66}
I have tried all sorts of combinations of creating it as root, creating it as myself, changing permissions on the vmdk, changing permissions on /dev/sdb* - All to no avail.
So - Now there are two of us!