KVM and QEMU Virtualization
Server Training - Ubuntu Server Administration

KVM and QEMU Virtualization

KVM/QEMU Short Course $39.95

What is Virtualization?

You've probably heard about virtualization, and have wondered what all of the buzz is about. There are two broad categories of virtualization.

  • Resource virtualization--This is the type of technology that, for example, allows a swap partition on your harddrive to simulate extra physical memory. You normally hear this referred to as "virtual memory". (You don't normally hear the term "virtualization" when referring to this technology, but regardless, that's what it is.)
  • Platform virtualization--This is when you can have one single computer run separate, independent instances of either the same operating system, or of different operating systems. (Each one of these instances is referred to as a virtual machine.) You may think that it's a brand-new technology, but it's actually been used in the esoteric world of big-iron mainframes for several decades; it's only fairly recently been made available for us mere mortals. This is the type of virtualization that we'll be discussing in this series of lessons.

 



Why Have Virtualization?

There are several reasons why someone may want to set up one or more virtual machines on a single physical computer.

  • A web hosting service may need to have several different servers to meet the needs of its clients. It would cost less to set up several virtual servers on one physical machine, than it would to buy separate physical servers to facilitate each client.
  • A software developer may want to set up a virtual machine to test new software. By running the new software in a virtual machine, any bugs in the software that would cause a system crash would only cause the virtual machine to crash; the system as a whole would be unaffected. This would help to eliminate the risk of crash-related filesystem damage on the harddrive.
  • Let's say that your favorite operating system just happens to be Ubuntu Linux. (It is, isn't it?) But, your business requires you to run a proprietary program that's only available for Windows. With virtualization, you can forget about the headache of dual-booting, or of having to hope against hope that your Windows application will work under WINE. Just open a virtual machine, and you can have Windows and Linux working side-by-side. And, if your application works under native Windows, you can be reasonably certain that it'll also work in a Windows virtual machine.
  • Or, let's say that you like to try out different operating systems. By setting up a virtual machine for each new operating system that you'd like to try out, you avoid the hassle of having to repartition your harddrive. You also avoid the risk of making the partition for your working operating system unbootable. (All flavors of Ubuntu are excellent at detecting existing partitions for other operating systems, and adding them to the GRUB boot-up menu. Some other Linux distros, however, aren't near as considerate.)


QEMU and KVM

There are several different virtualization software packages available. Each has its own strengths and weaknesses. For this series of lessons, we'll concentrate on the QEMU and KVM packages. Of the four scenarios that we presented above, these two packages won't help you with the first one, but they can help you with the second, third, and fourth ones.

What's the difference between QEMU and KVM? Well, to simplify things a bit. . .

QEMU provides virtualization purely by means of software, and can be used as a stand-alone package.

KVM--which stands for "Kernel-based Virtual Machine"--provides for hardware-assisted virtualization. It can only be used with newer processors, such as Intel Core 2's or more recent AMD Athlon64's. It must be used in conjunction with QEMU. Also, you'll want to run it with at least kernel version 2.6.20. (That means, you'll want to install it on at least a Feisty Fawn version of the Ubuntu family.)