FreeBSD: Adjusting Xen VM to run on KVM

 

Disk names

adjust fstab devices to use labels, if possible

 

otherwise the system will not be able to automatically mount root

It'll crash to the mountroot dialog

pressing "?" will show a list of devices

depending on the device model set for the virtual disk you would end up with either of

ada0a, vbtd0a or da0a 

(there might be a typo in vbtd0a, the system is currently off)

Enter your root device like this

mountroot> ufs:/dev/ada0a

And it'll boot!

 

Networking

Adjust your network device names

in /etc/rc.conf you'll need to adjust the name of your network device.

The old one will have been xn0, and the new one can be either em0 (emulated driver) or vn<something>0.

The latter is the higher-performing virtio device. It *felt* slower than xn0, but that is not really a test at all, just a feeling.

 

Shutting down

proper automatic shutdown is via acpid

http://freebsd.1045724.n5.nabble.com/Problem-with-FreeBSD-graceful-shutdown-td4227264.html

so you need to have it enabled, and for me it only worked after an initial reboot, not on the first time

 

Clock stability

Different from Xen there seems to be no proper virtual clock driver

That means you'll get the horrible "microuptime went backwards" messages if you save/resume the vm, and possibly after live migrations, too.

This bears a high operational risk and, unless you find a way to fix it, you should not - I repeat - NOT run databases or other time-sensitive applications in FreeBSD on KVM.

At least test it doesn't happen on live migration, suspend/resume isn't the most common use case anyway.