# Jailed VirtualBox



## gkontos (Oct 24, 2012)

I am wondering if anyone has managed to get virtualbox headless working in a jail with multiple virtual machines.

Thanks


----------



## ziyanm (Oct 25, 2012)

Hi,

I do have virtual box 4.2 (from redports.org) running headless in a jail with a VNC console. I haven't tested extensively with multiple VMs running (just one Windows 7 VM) but there is an rc script that lets VBoxSVC start multiple VMs on jail startup.  Do you have issues with stability or configuration? The only tricky bits are
* Make the /dev/vbox* nodes visible in the jail using a devfs ruleset
* Install the VNC extpack by hand (may have been fixed now)
* Using sparse zvols  as raw devices caused stability issues

Let me know if you need more info.


----------



## gkontos (Oct 25, 2012)

Thanks for your input. I will try it and see in a virtual environment first.


----------



## volax (Nov 7, 2012)

gkontos said:
			
		

> I am wondering if anyone has managed to get virtualbox headless working in a jail with multiple virtual machines.
> Thanks





			
				ziyanm said:
			
		

> Make the /dev/vbox* nodes visible in the jail using a devfs ruleset



Adding 
	
	



```
add path '*vbox*' unhide
```
 to /etc/defaults/devfs.rules allows to run multiple machines within a jailed VirtualBox.

Thank you guys!


----------



## gkontos (Nov 12, 2012)

Ok, it works perfect! Just a minor input, I had to add the following:


```
jail_sysvipc_allow="YES"
```


----------



## ziyanm (Nov 18, 2012)

If anybody tries using zvols for VM storage http://schlueters.de/blog/archives/137-ZFS-and-VirtualBox.html I would like to know if you experience any issues.


----------



## _martin (Nov 18, 2012)

ziyanm said:
			
		

> If anybody tries using zvols for VM storage http://schlueters.de/blog/archives/137-ZFS-and-VirtualBox.html I would like to know if you experience any issues.



I don't think this applies to FreeBSD - there's no DFSs for zvols in here. This can be (in my opinion) applied to Solaris/Illumos only.


----------



## _martin (Dec 20, 2012)

Hm, I was actually wrong - FreeBSD does create these DSFs, but only for sparse ones. I'm running Solaris 11.1 under VirtualBox on FreeBSD host using rawdisk as specified in that howto. There's only one difference - registerimage subcommand does not exist.
I've attached this disk the usual way: 


```
VBoxManage storageattach sun01 --storagectl SATActl --type hdd --port 0 --device 0 --medium /local/vbox/sun01/sun01.vmdk
```

Where vmdk was created by internalcommands subcommand mapping to /dev/zvol/zroot/lun/vbox-sun-lun00 DSF. Prior to this command I had to change the ownership so vbox user could read/write to it.

So far, so good, no stability problems. This disk can't be expanded though. Currently only VDI/VHD formats are supported and internalcommands creates VMDK. I see more changes were done to VirtualBox recently, it's time to read manual once again .


----------



## _martin (Dec 21, 2012)

ziyanm said:
			
		

> If anybody tries using zvols for VM storage http://schlueters.de/blog/archives/137-ZFS-and-VirtualBox.html I would like to know if you experience any issues.



@ziyanm: Actually, you deserve thanks for that. Though indirectly, but still, you helped me to solve a problem I had as I thought DSFs are not created on FreeBSD for ZFS filesets.


----------

