kvm

Provisioning Ubuntu KVM images in a home lab

Posted by bosse
9 August 2008 - 11:01pm

From time to time, having the ability to test your projects on a home lab system is a very good thing. In my home lab, I'm doing everything from testing small web-based projects to simulations of large-scale deployments.

There are two major, open source solutions for Linux that I care enough to think about when it comes to virtualization, Xen and KVM. Xen is in my opinion best suited for a datacenter environment, when the sole purpose of the box is to host virtualized guests, but it needs a patched kernel, and using X on a xenified kernel (for example when the same box is used as your livingroom multimedia center) is a pain, especially if you're on NVIDIA.

The kernel-based virtual machine (KVM) is provided with the stock Linux kernel, and provides full virtualization on machines with Intel VT or AMD-V CPUs. It also works fine in tandem with X and other applications. I have been using KVM (and kqemu) for a long time, but I've been basing my usage on manually doing the provisioning on the command line. That grew to be a series of long, mundane tasks, especially when I needed to provision several guests at the same time.

I made a couple of scripts to make it easier to provision a series of Ubuntu guests based on a LVM logical volume with a base image. The provisioning script creates a snapshot of this base image, mounts and modifies essential files directly on the guest filesystem, and creates an init-script in /etc/init.d.