virtualisation
KSM - Kernel Samepage Merging and KVM
Here at Bitcube we use KVM as our preferred virtualisation platform. It has the best Linux support and is the standard for all Linux distributions. Whilst it still shows a bit of immaturity at times, there is an upside - rapid development and improvements.
VMWare server and paravirtualisation
Virtualisation has gone through four main phases:
- full software emulation - every instruction is emulated - very, very slow. (Bochs)
- software virtualisation - instructions are checked but most run natively. (VMWare server)
- paravirtualisation - the guest operating systems know they are virtualised and are tweaked appropriately (Xen)
- hardware assisted virtualisation - the CPU provides assistance to the above methods (KVM)
The programs above are only very roughly categorised, for example virtio provides paravirtualisation to KVM.
Converting KVM images to logical volumes
When creating virtual disks for KVM you can use several methods. Most people use flat files in one of several formats - raw and qcow2 being the most popular. qcow2 files can compressed and also have "holes" (where unused space doesn't use up real space).
We recently converted some old systems from flat files to using logical volumes as it's the recommended approach these days.
If you are using raw flat files (use "qemu-img info filename.img" to find out) then you can just use "dd if=filename.img of=/dev/rootvg/logicalvolume".
Qemu-KVM packages
KVM is the "preferred" Linux virtualisation solution (at least as long as you have hardware support that is). Beware that the management tools for KVM are still fairly immature - VMware's vSphere product for example is still leagues ahead in terms of production usage.
Feature wise however, KVM is pretty good even if the libvirt abstraction layer support tends to lag a little behind.
CentOS v5.2 paravirtualised
Overview
How to add paravirtualisation to CentOS v5.2.
Problem
In order to replicate a customer environment, we have some CentOS 5.2 virtual machines for development. However CentOS 5.2 does not feature any paravirtualisation and thus the performance of both the guest and host machines suffers.
Solution
By creating a custom Linux kernel with paravirtualisation support and making some adjustments to the initial ramdisk used for booting, we created a paravirtualised CentOS 5.2 machine.
Howto
First of all we must build the kernel: