Setting up a kavoom host

Kavoom is a thin wrapper around the kvm binary. It provides a command line driven management interface to kvm without running any additional daemons. See the project page.

Table of contents

The operating system

This manual assumes you run Debian GNU/Linux 11 “bullseye”. Instructions for installing the operating system are outside the scope of this document, but it is strongly recommended that you:

Installing the software

Add the repositories as explained on the main kavoom page. Then:

apt-get install kavoom

Preparing the network

Make sure you're not logged in over the network (as we're going to reconfigure it) and:

ifdown eth0

Edit the file /etc/network/interfaces and replace all occurrences of eth0 with br0. Add the following lines to the stanza:

    bridge-ports eth0
    bridge-fd 0
    bridge-maxwait 0

The final result should look something like:

auto br0
iface br0 inet static
    bridge-ports eth0
    bridge-fd 0
    bridge-maxwait 0

Now bring the network up again:

ifup br0

And you're done! You now have a fully functional VM host. You could read the user manual to set up your first VM.

Some optional but recommended tweaks


Hugepages are a more efficient way to manage memory. If your host is a dedicated VM host, you can reserve a chunk of memory for use as hugepages. Kavoom will automatically pick this up and will tell KVM to allocate its memory from that chunk.

Hugepages on x86_64 are 2MiB in size, and you need some space for the OS itself. On a dedicated server with 16GiB that means 7500 is probably a reasonable number of hugepages.

Do the math for your own system and add hugepages=7500 to GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub.

Then run:

sysctl -w vm.nr_hugepages=7500

However, that last command is likely to fail if your server has been up and running for a while (due to fragmentation). In that case rebooting is the only sure way to effect the desired number of hugepages.

Systems without /dev/hugepages

If your system does not mount hugetlbfs by default (check the output of mount if you don't know), you'll have to mount it yourself.

Add this line to your /etc/fstab:

hugepages  /dev/hugepages  hugetlbfs  defaults

Then run these commands:

mkdir /dev/hugepages /lib/udev/devices/hugepages
mount /dev/hugepages

Using control groups

Control groups (abbreviated as cgroups) are a fairer way to distribute various resources over VMs. For example, it prevents one VM from hogging the CPU by creating a large number of threads. To use control groups with kavoom, create a file /etc/kavoom/wrapper:

#! /bin/sh

set -e

for cg in blkio cpu,cpuacct net_cls,net_prio
    mkdir -p "$group"
    echo $$ >"$group/cgroup.procs"

exec kvm "$@"

This puts every VM in its own control group when it starts.

To make this script active, append the following line to /etc/kavoom.cfg:

kvm = /etc/kavoom/wrapper


VirtIO is a type of virtual hardware that is optimized for virtual machines. Simply add this to /etc/kavoom.cfg to use this feature for all VMs:

virtio = yes


EFI is the modern way to boot computers. Simply add this to /etc/kavoom.cfg to use EFI for all VMs:

platform = efi

You may need to install the ovmf package.

4 KiB block sizes

Using larger I/O block sizes reduces the number of block I/O operations and usually improves performance. Unfortunately GPT partition tables are specific to a block size, so changing it for an existing VM is tricky. For a new VM called pikachu you can add this to /etc/kavoom/pikachu.cfg:

block_size = 4096

If you are not afraid of affecting existing VMs and you want to enable this for all VMs, you could add it to /etc/kavoom.cfg instead.


Newer versions of qemu support a more efficient way of doing parallel async I/O, which may improve disk performance. Simply add this to /etc/kavoom.cfg to use this feature for all VMs:

aio = io_uring

Back to the index page

mail me