Knowledge Base

31.01.11

Adding "raw" devices such as /dev/sda1 or /dev/md0 to Virtualbox

Virtualbox sometimes causes unnessesary woes. While in xen i can simply add a raw device (such as /dev/hdv1) to a VM, in virtualbox on first glance there is no way to tell the Virtualbox gui to add a mass storage controller based on a real rawdevice and not just a loopback file

in my case i had added two huge harddisks to a server and wanted to use a 50GB partition from both of them as a md RAID1 for a VM in Virtualbox which needed more storage.

so i created /dev/md1 , launched the virtual box gui and wanted to add /dev/md1 to the vm but this is not supported from there, you can only select vmdk files or loopback files.

but there is a very easy way to do so from the shell, it is so easy actually that oracle could also integrate that into their gui but i guess they simply do not want to make it that easy ....

VBoxManage internalcommands createrawvmdk -filename /Virtualbox/Harddisks/$nameoffile.vmdk -rawdisk /dev/md1 -register

well, that did the job and i simply added /Virtualbox/Harddisks/$nameoffile.vmdk to my VM and it works....

 



<- Zurück zur Übersicht