Testing out the Xen live CD
Linux had always lacked a open source virtualization technology in the same league as Solaris Containers or a commercial product like VMware. That was until Xen came into the picture. Xen is an open source virtual machine monitor for x86 that supports execution of multiple guest operating systems. Xen is released under the GPL and can easily be used to run operating systems as diverse as different Linux distributions, BSDs and even Windows XP (though Windows port is not available because of licensing restrictions).
Virtualization technologies are nothing new, what with VMware, User-mode Linux and others available. But Xen is relevant here because of the support for it from Red Hat, its GPL license, and also its active development. Strictly speaking, Xen does not do full virtualization like that being done by commercial ventures like VMware. But it presents a virtual machine abstraction that is similar - but not identical - to the underlying hardware. This type of semi virtualization is dubbed by the makers of Xen as para-virtualization.
The benefits of using para-virtualization over full virtualization are the improved performance and strong resource isolation on uncooperative machine architectures like x86. Of course, there is a down side to it too in that you need a specially compiled Linux kernel to successfully run Xen on Linux. A comparison of Xen over other virtualization technologies (like VMware and Usermode Linux) has already been published.
Xen Live CD - A ReviewRecently, a Live CD was released to showcase the power of Xen virtualization. I had downloaded the Xen Demo Live CD ISO image (503 MB) from their website and burned it on to a CD in order to give it a trial run. What follows below are my experiences in trying out this very promising virtualization technology.
The Xen Live CD comes with two images: Debian Etch and CentOS 4.1.
When I booted using the Live CD, I was presented with the GRUB boot loader
which gave me a choice of booting either of the two systems.
I selected Debian Etch and the booting proceeded without
any problem. It took around 3 minutes to present the GUI login screen. Xen
live CD uses GDM as the display manager and loads the Xfce desktop.
When the gdm (Gnome display manager) was fully loaded, you are presented
with the login screen where you are prompted to log in as user
'root' and password 'xensource'. Once you are logged in, you
are presented with two open applications - one an X terminal and another
giving a real time data of the virtual machine status (see figure, left).
Next I decided to create a virtual machine for the CentOS Linux
distribution inside the Debian etch distribution. For achieving this, you
have a command line utility called xm. I
created the CentOS image by running the command :
# xm create -c /root/centos-conf name=centos_1
It gave an error, saying that it couldn't find enough memory to load CentOS and that it needed at least 96 MB for the same when there was only 17 MB available. The machine on which I tested Xen is a Pentium IV 256 MB RAM machine. At this point I realized that almost all the memory on my machine was allocated to Debian.
I figured out that one can reduce amount of memory allocated to the virtual OSes by using the same xm utility. For that you have to find the domain ID of the virtual OS whose memory allocation you want to change.
# xm domid Debian_os1 0Now that I got the domain id of the Debian etch virtual os, I reduced the memory allocated to it to 98 MB as follows :
# xm mem-set 0 98
The above command reduces the memory allocated to the domain ID 0 to 98 MB. Thus I succeeded in reducing the memory allocated to the Debian etch os to just 98 MB. Which meant at least 100 MB memory was freed in the process.
After that I again tried creating the CentOS virtual system. The previous low memory error was rectified but CentOS started in the paused state and I set about figuring out how to unpause it - which was quite simple as finding the domain id of the centos_1 image and then unpausing it using the universal xm command.# xm domid centos_1 2 # xm unpause 2
That done, eventually I got the CentOS login screen shown on the right.
Of course, if I have enough memory, I can start any number of these virtual OSes following the above methods. Xen uses VNC to display the virtual OS. So if you are starting say 10 virtual OSes, each will have its own VNC window. You can even start Xen on a server and then access a complete independent OS using a VNC client from a remote machine.
Uses of Xen VirtualizationHere are a few ways I figured out how Xen could be put to good use.
- If you are a student interested in getting hands-on networking skills, then you can set up your own virtual networking lab on your home computer provided you have at least 1 GB RAM. Using three or more virtual OSes, you can set up a virtual network and try out tasks like routing, bridging, setting up gateways, running firewalls, subnetting your network and more, all in the safe confines of a virtual environment.
- As a frequent netizen, you must be aware of the rumors that spread
around two months back, of a certain very popular public company
which planned to bring out its own operating system
based on Linux. Of course, the rumor turned out to be a dud. But if
such a project were to kick off, then it will most probably be using
virtualization technology like Xen. Using Xen, each user can be given his
own copy of a OS complete with root privileges. And since Xen is using VNC
to display the desktop, it is most suitable for a network OS.
- Kernel developers and debugging specialists in the kernel space will find Xen useful because they can compile code and try out things on the virtual system without affecting the parent system.
- Application developers on the Linux platform can test their applications on different Linux distributions at the same time by running copies of the distributions simultaneously using Xen on their PC.
- Needs to enable virtualization in the parent Linux kernel which, at this time, requires recompiling a kernel from source. But it is bound to change when Intel supports virtualization at the hardware level on more of its CPUs.
- Needs a good amount of memory for it to be of any use to anybody. I
would recommend at least 1 GB memory even though, with a little bit of
tweaking like I did above, you might be able to use it with less than 256
MB RAM.
- It is a relatively new technology (when compared to products like VMware which do full virtualization).
| Index entries for this article | |
|---|---|
| GuestArticles | Kumar, Ravi |
The LWN site is currently under high scraper load, so comment display has been suppressed for anonymous users. If you are a human, you may read the comments by clicking the button below:
Note: you can avoid this step in the future by logging into your LWN account.
