A collection of notes on Kernel based Virtual Machines (KVM)

These notes are on the Kernel Based Virtual Machine. They are a work in progress and cover a range of topics from introductory tutorials to specific topics/issues. Most examples will be from a KVM setup running on fedora Linux.

Using the Virtual Manager to install a KVM guest

A virtual machine (VM) is a software implementation of a computer. Systems that implement virtual machines provide a way of managing the underlying real/physical machine so that it can be split up between different virtual machines, each running its own complete operating system (called a "guest").

Accessing the contents of a KVM disk image

A kernel based virtual machine (KVM) can use either an entire partition to simulate a disk for the guest operating system, or a single file. By default the file type used is a "raw" file compatible with other virtualization systems, like Xen. Other optional file types are more flexible, allowing compression and encryption of the contents (qcow2), or compatibility with VMware (vmdk). Access to the simulated file sytems contained within the file from outside the guest operating system is possible. For example, access from the host or real Linux system.

KVM Virtual Manager Network Timeout

Small and simple guest operating systems (i.e. those not running many services) can tend to have network difficulties when using the default KVM and Virtual Machine Manager virtualization. I use a very small Debian etch guest that is a mirror of an identical small machine elsewhere. If the guest OS does not use the network connection for around 10 minutes, the idle network can become disconnected. This is actually a result of the iptables NAT setup by the Virtual Manager.

KVM and SELinux

In Fedora 9, kernel based virtual machines (KVM) are now constrained within SELinux. This is a good thing as it means any security bugs in the KVM/qemu infrastructure are less likely to impact on the host system. However, when moving from earlier versions of Fedora the KVM guest image files (e.g. of the form opensolaris.img) will probably be labelled with the wrong SELinux type which will prevent the guests from running on Fedora 9. To see the SELinux type labelling you can use the -Z option to the normal ls command: