Linux 2.6.20 Integrates Kvm Hypervisor For Hardware Virtualiztion

based Virtual Machine (KVM) has been around for(some of the output is truncated)
sometime and now is integrated with the linux kernelThere are two sets of flags because the system has
as of version 2.6.20. This new marriage makes ittwo processors (which isn’t uncommon on
possible to run other operating systems, such asnewer systems). You would be looking for the
Windows XP and others within your Linux system.“vmx” flag for an Intel-VT and the “svm”
KVM takes advantages of the hardware supportflag for an AMD-V processor.
provided by the Intel-VT and the AMD-V processor.With the KVM module installed, you can now start
Under KVM’s model, every virtual machine is ayour guest operating system in user-space. For
regular Linux process scheduled by the standard Linuxstarters you could test KVM by initiating a KVM
scheduler. A normal Linux process has two modes ofsession using a bootable CDROM or DVD (ISO or
execution: kernel and user. KVM adds a “guest”physical media). If you need a permanent virtual
mode which has its own kernel and user modes.server then first you would have to create a disk
Running Windows XP over KVM/Linux comparesimage and then start a KVM session with your
favorably to the native execution of Windows XP. Ininstallable media attached to the session. Here is the
comparison to its predecessor QEMU, KVM clearlyquickest way to do that:vlab-host01:/vm/winxp $
out performs it in most cases more than 10:1qemu-img create -f qcow virtual-disk.img 5G
according to Linux Insight. However QEMU andFormatting ‘virtual-disk.img’, fmt=qcow,
KQEMU coupled together will still give KVM a run forsize=5242880 kBvlab-host01:/vm/winxp $ ls -l
the money without the need for virtualization supportvirtual-disk.img
built into the processor.-rw-r—r— 1 root root 20528 Dec 10
The KVM Hypervisor22:19 virtual-disk.img
The KVM code simply turns a Linux kernel into aThis creates a 5GB disk image in qcow format. This
hypervisor simply by loading a kernel module. Thedynamic disk image is a little bit less that 20KB initially
kernel module exports a device called /dev/kvm,when created, but will expand as-needed up to 5GB.
which enables a guest mode of the kernel (in additionYou could make an image that starts out at 5GB as
to the traditional kernel and user modes). With /devwell, but this way saves space.
kvm, a VM has its own address space separate fromNext you can either create an ISO image of your
that of the kernel or any other VM that’sinstallation media (generally faster) or you can just
running. Devices in the device tree (/dev) areuse the physical device link to install your guest
common to all user-space processes. But /dev/kvm isoperating system from.
different in that each process sees a different deviceIn linux you can use a command like dd to create an
map (to support isolation of the VMs). With theISO image from a CDROM or DVD:vlab-host01:/vm
kernel acting as a hypervisor, you can then startwinxp $ dd=if=/dev/cdrom of=winxp-sp2.iso
other operating systems, such as another Linuxbs=1024K
kernel, Windows, or another operating system.Make sure that you are in a windowing environment
Using KVMlike GNOME or KDE (others work too). Now you can
Using KVM is really quite simple assuming that youinitiate a KVM session like this:vlab-host01:~ $ kvm
have the hardware to support it, and all of the-no-acpi -m 512 -smp 2 -cdrom winxp-sp2.iso -hda
necessary KVM packages installed on your system.virtual-disk.img -boot d
Enter this command at a shell prompt If you need toIn this case, the kvm command initializes a session
check to see if your processor supports hardwarethat has 512MB of memory, attaches our installation
virtualization (works with bash, but should also workimage “winxp-sp2.iso” to the cdrom device (
with other shells):vlab-host01:~ $ egrepdev/hdc), and the qcow image “virtual-disk.img”
‘(vmx|svm)’ /proc/cpuinfoflags : fpu vmeto the first hard disk (/dev/hda), boots from the
de pse tsc msr pae mce cx8 … vmx …flags : fpuCDROM, emulates 2 processors, and turns off ACPI
vme de pse tsc msr pae mce cx8 … vmx …(still a few bugs).