VirtualBox on FreeBSD Tuning Guide

Timer frequency

Kernel's timer frequency ("HZ") in FreeBSD 6.x and above is set to a relatively large value - 1000 Hz. While beneficial on real hardware, High HZ setting has a negative impact on simulated machine's performance because the VM host software spends too much time handling timer interrupts, which causes context switches, cache flushes and other performance-hindering operations. FreeBSD 9.0 autodetects if it is running as VirtualBox guest and sets kern.hz to 100 automatically.

/boot/loader.conf in the Guest:

# Decrease timer frequency for better performance

Bridged Network

If you use bridged networking and transfer big chunks over the network or have heavy network load netgraph probably runs out of memory.

/boot/loader.conf on the Host:

# Increase netgraph memory size for heavy VirtualBox network load


VirtualBox can emulate ATA and SATA controllers but defaults to ATA for FreeBSD guests. FreeBSD also supports SATA and AHCI and performance is a lot better if you have AHCI enabled on the host and the guest. Since FreeBSD 9.0 the new CAM infrastructure is enabled per default so you already see your devices as /dev/ada0. For FreeBSD 8.x you need to explicitly enable it but beware - your device names will change from /dev/ad0 to /dev/ada0 so you probably have to modify your /etc/fstab too.

/boot/loader.conf for FreeBSD 8.x on the Host and Guest:


VirtualBox: 1. Go to Virtual Machine settings, switch to "Storage" tab; addsata_init.png

2. On the bottom of the devices list, click "Add Controller", then "Add new SATA controller" addsata_step1.png

3. Click "Add new disk", "Add new Hard disk" addsata_step2.png

4. Select existing drive or create a new one.


VirtualBox/Tuning (last edited 2015-12-22T02:57:43+0000 by MarkLinimon)