Guest Example: Windows - churchers/vm-bhyve GitHub Wiki
If you plan on running Windows, it is highly advised that you are running FreeBSD 11+ and use UEFI graphics support.
First of all you will need to make sure you have the UEFI firmware if not already installed. Then create a guest using the standard Windows template
# pkg install bhyve-firmware
# vm create -t windows myguest
# vm install myguest Windows.ISO
Connect to the guest with VNC to start the installation.
Sample Template
loader="uefi"
graphics="yes"
xhci_mouse="yes"
cpu=2
memory=2G
ahci_device_limit="8"
network0_type="e1000"
network0_switch="public"
disk0_type="ahci-hd"
disk0_name="disk0.img"
utctime="no"
If you are running a version of Windows older than Windows 10, you will need to set the disk sector size to 512 using the disk0_opts="sectorsize=512" option.
Adding VirtIO network drivers
While the e1000
network adapter works out of the box and allows the guest to get network access, it is recommended to use the virtio-net
device where possible. There are several ways of installing these drivers.
-
If the machine has Internet access via the e1000 device, you can download and install the virtio drivers directly in the guest. Once installed, shutdown the guest, change the device in guest configuration and restart.
-
The guest can be booted in install mode, but specifying the VirtIO ISO file.
# vm install winguest virtio-installer.iso
-
A CD device can be added to the guest and pointed at the ISO file
disk1_type="ahci-cd" disk1_dev="custom" disk1_name="/full/path/to/virtio-installer.iso"
Regarding CPUs
Some versions of Windows (most desktop versions) do not support more than one physical CPU. By default, bhyve configures every virtual CPU and a separate package.
The hw.vmm.topology.cores_per_package
sysctl can be modified to tell bhyve to create multiple cores per CPU, rather than separate pacakges. For example, setting this sysctl to 4 will cause a guest with 8 vCPUs to have 2 x 4 core packages.
hw.vmm.topology.cores_per_package
must be set in /boot/loader.conf (and a reboot to take effect).
On FreeBSD 12, when using vm-bhyve 1.3, it's possible to control CPU topology for each guest using configuration options -
cpu=8
cpu_sockets=2
cpu_cores=4
cpu_threads=1