You are not logged in.

#1 2009-05-15 18:34:31

pxhza
Member
From: Finland
Registered: 2008-10-19
Posts: 9

Own partition to VirtualBox...?

Hi,

I have currently two HD's and they are partitioned like this:
--------------------------------------
sda1 ext3 /
sda2 reiserfs /var
sda3 linux-swap
sda4 ext3 (empty at this point, and also the reason I'm making this topic)
-----
sdb1 ext3 /home
--------------------------------------

Now, what i would like to do is to make that empty partition (sda4) to be only used by VirtualBox. Is there any practical way to do it? And if it isn't possible, how i can mount it to be something useful? Can it be i.e. "/home/username/directory" or do i have to make it somethin else (and probably not as useflu hmm )


Sorry about my poor English wink

Offline

#2 2009-05-15 18:40:12

Wintervenom
Member
Registered: 2008-08-20
Posts: 1,011

Re: Own partition to VirtualBox...?

VBoxManage internalcommands createrawvmdk -filename $HOME/.VirtualBox/HardDisks/My_Physical_Disk.vdmk -rawdisk /dev/sda4 -register

Last edited by Wintervenom (2009-08-03 14:14:36)

Offline

#3 2009-05-15 18:44:36

pxhza
Member
From: Finland
Registered: 2008-10-19
Posts: 9

Re: Own partition to VirtualBox...?

Wintervenom wrote:

$(VBoxManage internalcommands createrawvmdk -filename $HOME/.VirtualBox/HardDisks/My_Physical_Disk.vdmk -rawdisk /dev/sda4 -register)

"Error opening the raw disk '/dev/sda4': VERR_ACCESS_DENIED
The raw disk vmdk file was not created"


Sorry about my poor English wink

Offline

#4 2009-05-15 19:15:24

dmartins
Member
Registered: 2006-09-23
Posts: 360

Re: Own partition to VirtualBox...?

I'd guess that you need write access to /dev/sda4. Try adding yourself to the disk group and then logging out and back in. Read section 9.10 of the virtualbox help file before continuing.

But, before you do that, what exactly are you trying to achieve? Would you like that entire partition to be used as a raw virtualbox disk image? You won't be able to mount this partition in your host OS and it can only be used for one guest OS. Section 9.10 of the help file explains setting this up.

In my opinion, you should leave /dev/sda4 formatted as ext3 (or ext4) and mount it where ever you'd like. By doing this, you can still store other files on the partition AND you can have multiple Vbox disk images and therefore multiple guest operating systems. This is a much more flexible approach but is _slightly_ slower than using a raw disk image because VirtualBox has to access it's disks through the host's filesystem.

To set up the second method:

Create the mount point:

$ mkdir /home/username/directory

add a line to /etc/fstab to automatically mount the partition at boot (make sure this is after the line for you home partition):

/dev/sda4 /home/username/directory ext3 defaults 0 0

as root:

# mount /dev/sda4
# chown username:username /home/username/directory

Now you can create a disk images in virtualbox and store them in /home/username/directory

Offline

#5 2009-05-15 20:56:06

pxhza
Member
From: Finland
Registered: 2008-10-19
Posts: 9

Re: Own partition to VirtualBox...?

dmartins wrote:

In my opinion, you should leave /dev/sda4 formatted as ext3 (or ext4) and mount it where ever you'd like. By doing this, you can still store other files on the partition AND you can have multiple Vbox disk images and therefore multiple guest operating systems. This is a much more flexible approach but is _slightly_ slower than using a raw disk image because VirtualBox has to access it's disks through the host's filesystem.

This was exactly what i wanted. Big thanks dmartins!


Sorry about my poor English wink

Offline

#6 2009-05-18 15:58:37

ixzus
Member
From: Barcelona (Spain)-Bristol (UK)
Registered: 2008-10-25
Posts: 26

Re: Own partition to VirtualBox...?

Also, if you haven't already done it, you can change VirtualBox preferences' to make it use that folder as the default
one when you create a nex box or virtual drive.

Go to File --> Preferences and in the General tab add the folders

eg Drives folder: /home/username/directory  (-my directory is called /home/username/VBoxDrives)
and Box or machine folder: /home/username/directory/Machines (-mine is then /home/username/VBoxDrives/Machines)


"If at first an idea is not absurd, then there is no hope for it."  A. Einstein

Offline

Board footer

Powered by FluxBB