Mounting VirtualBox vdi files

Kyryll A Mirnenko aka Mirya mirya at zoc.com.ua
Tue Jul 6 15:58:32 UTC 2010


If you're creating the VM from scratch, you may use raw file-backed disk image 
along with VMDK format wrapper. You may create a sparse file

# truncate -s 2G img

or a preallocated one

# dd if=/dev/zero of=img bs=1m count=2048

, then create a character device for it

# mdconfig -a -t vnode -f img -u 4

, and wrap it with a vmdk container

# VBoxManage internalcommands createrawvmdk -filename 
Img.vmdk -rawdisk /dev/md4

After that you may use Img.vmdk as any other disk image in VirtualBox, and 
mount /dev/md4* from the host machine. Just remember you'll need to run 
mdconfig after reboot, the md* devices are not preserved magically, and 
umount /dev/md4* before starting VBox.
That's how i work with -current FreeBSD snapshots - they're cross-compiled and 
cross-installed in the host system (which is faster), then run in the VBox.
-- 
Regards, Mirya
ICQ #313898202


More information about the freebsd-emulation mailing list