Why bhyve Outperforms VirtualBox on FreeBSD
If you’re used to KVM on Linux or ESXi, you’ll find that bhyve (pronounced “beehive”) takes a very different approach. It is a Type-2 hypervisor that runs so close to the hardware that performance is nearly lag-free. It has been integrated into the FreeBSD base system since version 10.0 and is extremely streamlined.
Let’s look at the reality when comparing bhyve to other solutions:
- VirtualBox: It has a GUI, but its performance on FreeBSD is quite poor. It is resource-intensive and frequently causes kernel panics if the host is under heavy load.
- QEMU: Can emulate almost anything, but it’s very slow because it’s not specifically optimized for the FreeBSD kernel.
- bhyve: Fully leverages Intel VT-x or AMD-V. In I/O tests, bhyve provides disk write speeds via VirtIO that are approximately 25-30% faster than VirtualBox.
I am running a storage server using ZFS on FreeBSD. Instead of setting up a separate server for auxiliary services, I run 3 Linux VMs (Docker, Home Assistant, Pi-hole) directly on bhyve. The system has been running for 200 consecutive days without a reboot, and the RAM overhead for each VM is only about 20-50MB.
Pros and Cons in Practice
Pros
- Native ZFS: The ability to snapshot a virtual machine in 1 second by leveraging ZFS datasets.
- No System Clutter: No need to install dozens of dependencies or strange third-party kernel modules.
- Extremely Lightweight: The bhyve executable is tiny, with no background processes consuming CPU.
Cons
- Purely CLI: You have to be comfortable with the command line. Manually configuring PCI bus parameters can be daunting for beginners.
- Graphics: VNC support for Windows is stable but not suitable for use as a video editing or gaming workstation.
Using vm-bhyve: The Smartest Way to Manage
Don’t bother typing the bhyve command directly with a long string of parameters. The vm-bhyve tool is an excellent wrapper that helps manage VMs in a modern style. It makes virtual machine management as simple as using Docker or Vagrant.
Detailed Deployment Steps
1. Check Hardware Compatibility
First, ensure your CPU supports virtualization:
grep -E 'VT-x|POPCNT' /var/run/dmesg.boot
If there are no results, check your BIOS/UEFI and enable the Virtualization feature.
2. Install Management Tools
Install the standard combo of vm-bhyve and firmware for UEFI booting:
pkg install -y vm-bhyve grub2-bhyve bhyve-firmware
3. Configure the Foundation
Assuming you are using ZFS (highly recommended), create a dedicated place to store your VMs. This helps isolate data and makes quota management easier.
# Create dataset
zfs create zroot/vm
# Declare to the system
sysrc vm_enable="YES"
sysrc vm_dir="zfs:zroot/vm"
# Load virtualization modules
kldload vmm
echo 'vmm_load="YES"' >> /boot/loader.conf
echo 'nmdm_load="YES"' >> /boot/loader.conf
# Initialize vm-bhyve
vm init
4. Set Up Network (Virtual Switch)
We will create a virtual switch and connect a physical network card (e.g., igb0) to it. The VM will receive an IP directly from your router.
vm switch create public
vm switch add public igb0
5. Initialize Your First Linux VM
Copy sample templates to save configuration time:
cp /usr/local/share/examples/vm-bhyve/* /zroot/vm/.templates/
Create and install Ubuntu Server:
vm create -t ubuntu -s 40G web-server
vm install web-server ubuntu-22.04.iso
To enter the installation screen, use the console command. Press ~~. to exit when finished:
vm console web-server
Real-World Experience: Running Windows Smoothly
Installing Windows on bhyve often results in blue screen errors if VirtIO drivers are missing. In your windows.conf file, ensure you have the following lines to enable graphics:
loader="uefi"
graphics="yes"
graphics_res="1920x1080"
graphics_wait="yes"
vnc_password="secret123"
When the VM starts, use a VNC Viewer to connect to the FreeBSD host’s IP on port 5900. You will see the familiar Windows setup screen.
System Optimization (Best Practices)
After several trial-and-error sessions, here are some notes to keep your system stable:
- Force VirtIO: Always choose
virtio-blkinstead of AHCI. Actual speeds can be twice as fast when handling databases. - Limit ZFS ARC: If you don’t limit the RAM for ZFS, it will consume all the host’s memory. Set
vfs.zfs.arc_maxin/boot/loader.confto about 50% of total RAM. - Snapshot Before Tinkering: Always run
vm snapshot vm_name@before_tinkering. If you misconfigure something, it only takes 1 second to revert to the previous state. - CPU Pinning: If running latency-sensitive apps like VoIP, use
cpu_pinto pin CPU cores to the VM, avoiding contention from other processes on the host.
Summary
bhyve isn’t flashy and doesn’t have a colorful dashboard like Proxmox. However, if you prioritize stability, speed, and want to fully leverage the power of FreeBSD, bhyve is unrivaled. It truly is a virtualization “beast” hidden within a compact frame.

