FreeBSD Guest Notes

From Proxmox VE
Revision as of 23:05, 6 October 2012 by Ndelong2 (talk | contribs)
Jump to navigation Jump to search

Tweaks and tips for better performance with FreeBSD on KVM.

Enable Virto

WARNING: This part is currently in test - it may render your system un-bootable when you make changes to your /etc/fstab.

  • Install virtio-kmod:
cd /usr/ports/emulators/virtio-kmod && make clean install
  • When prompted on each required package, accept defaults and OK.
  • Copy the virtio modules into /boot/kernel directory:
cp -Rp /usr/local/modules/* /boot/kernel/
kldxref /boot/kernel
  • Add the following to /boot/loader.conf:
virtio_load="YES"
virtio_pci_load="YES"
virtio_blk_load="YES"
if_vtnet_load="YES"
virtio_balloon_load="YES"
  • Enable virtio for disk by changing your /etc/fstab entries to use the vtbd prefix. Example:
# Device        Mountpoint      FStype  Options Dump    Pass#
/dev/vtbd0p2    /               ufs     rw      1       1
/dev/vtbd0p3    none            swap    sw      0       0
  • Enable virtio for network by changing the ifconfig_em0="DHCP" line in /etc/rc.conf to:
ifconfig_vtnet0="DHCP"
  • Shutdown the VM
shutdown -p now
  • Change network and disk drivers to virtio.
  • Power on the VM.
  • Verify that virtio is loading:
kldstat

Id Refs Address            Size     Name
 1   12 0xffffffff80200000 11cdab0  kernel
 2    5 0xffffffff813ce000 4ca0     virtio.ko
 3    1 0xffffffff813d3000 5880     virtio_pci.ko
 4    1 0xffffffff813d9000 5010     virtio_blk.ko
 5    1 0xffffffff813df000 aeb0     if_vtnet.ko
 6    1 0xffffffff813ea000 3210     virtio_balloon.ko