How can I use physical partitions for my VMs?

This is for discussing general topics about how to use VirtualBox.
Post Reply
sonnet
Posts: 14
Joined: 10. Sep 2007, 23:21

How can I use physical partitions for my VMs?

Post 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
Image
Last edited by sonnet on 20. Aug 2011, 20:52, edited 2 times in total.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: How can I use physical partitions for my VMs?

Post 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!).
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
sonnet
Posts: 14
Joined: 10. Sep 2007, 23:21

Re: How can I use physical partitions for my VMs?

Post 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.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: How can I use physical partitions for my VMs?

Post 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?
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
sonnet
Posts: 14
Joined: 10. Sep 2007, 23:21

Re: How can I use physical partitions for my VMs?

Post 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?
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: How can I use physical partitions for my VMs?

Post 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.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
sonnet
Posts: 14
Joined: 10. Sep 2007, 23:21

Re: How can I use physical partitions for my VMs?

Post 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)
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: How can I use physical partitions for my VMs?

Post 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.
sonnet
Posts: 14
Joined: 10. Sep 2007, 23:21

Re: How can I use physical partitions for my VMs?

Post 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?
dpolshaw
Posts: 1
Joined: 20. Sep 2011, 13:28
Primary OS: Fedora other
VBox Version: OSE Fedora
Guest OSses: Windows XP

Re: How can I use physical partitions for my VMs?

Post 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!
Post Reply