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

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.

Printed from freebsd-emulation@freebsd.org mailing list from Kyryll A Mirnenko.