CentOS, OpenSourceSoftware, Virtualization

Virtualization with CentOS 5 and Xen-3.0.3

I have been running CentOS 5 with Xen virtualization since around mid April (I started to play with Redhat 5 beta and its Xen in Desember 2006). CentOS 5 ships with Xen-3.0.3 and with RedHat’s virt-manager, which is a very simple but OK tool to manage Xen guests/domUs. The only 1337 about virt-manager at this point, in my opinion, is the vnc integration.

A quick way to get up and running (if you are connected to internet), is to set up dhcpd on Dom0 and export an kickstart.cfg file by httpd etc. That is, if you dont have a dhcp on you network. If you do have a dhcp-server on your network, you should drop the dhcp part.

# yum install dhcp httpd
# cp /root/anaconda-ks.cfg /var/www/html/xen.cfg
# vi /var/www/html/xen.cfg

Change the permision of the file and remove etc. cdrom (install media) and %packages that you dont need. Driveorder should be xvda –driveorder=xvda.
Also add url –url http://your-centos-mirror.something.com/centos/5/os/{ARCH}. http://www.centos.org/modules/tinycontent/index.php?id=13 has a list of mirrors

# vi /etc/dhcpd.conf # setup you own network:

ddns-update-style interim;
ignore client-updates;
subnet netmask {
# — default gateway
option routers;
option subnet-mask;
option domain-name “v.gamelinux.org”;
option domain-name-servers;
# we want control over DomU’s adress
host node1 {
next-server node1.gamelinux.org;
hardware ethernet 00:16:3e:3e:c2:fd,;
host node2 {
next-server node2.gamelinux.org;
hardware ethernet 00:16:3e:4a:6f:87;

# service dhcpd start
# service httpd start

For some reason I like to have my DomU’s on a logical volume. I do not recommend this yet, cuz I lack testing, but here is how I end up doing it:

# lvcreate -L 10G -n LogVolN1 VolGroup00
# lvcreate -L 10G -n LogVolN2 VolGroup00

My setup, needs me to tail /var/log/messages to get the MAC address of the nodes (when you start the node installation), then edit the dhcp.conf and restart dhcpd. You could just setup a dhcp-pool.

Then you just fire up virt-manager, enter system name (node1 etc), choose your flavor of virtualization, and point to a centos mirror (http://mirror.hh.se/centos/5.0/os/i386/ ect.). The kickstart URL, should be the ip/host of you Dom0 (http://dom0.v.gamelinux.org/xen1.cfg etc.). Then choose normal disk partition : and use the lvm we just created (/dev/VolGroup00/LogVolN1). Choose an amount of memory and cpus, and the start the installation.

How much cpu and memory you give your guests are all up to you!


3 thoughts on “Virtualization with CentOS 5 and Xen-3.0.3

  1. I’ve always installed Xen from source and built the kernels and configuration manually. I’ve just started to play with the automated tools in CentOS5. There is much to like but I do have a concern about the Logical Volumes.

    We’ve always used logical volumes for our domains – both for the performance advantage of files and the flexibility to resize them. We would create several logical volumes on the dom0, e.g., domU1root, domU1swap, domU1home and mount these as separate disks in the domU.

    When run through the CentOS setup the virt-manager, it runs like a regular install and creates partitions on the existing logical volume. Thus, it creates a logical volume within the domU on top of the logical volume used for the domU. I like maintaining the flexibility to resize the partitions within the domU but am concerned about the performance. Is there a performance impact of having a logical volume on a logical volume for the domU? Thanks – John


  2. Hi,
    I have done no performance tests on a lvm on a lvm, but the overhead is small, but still there, so you will not gain any performance, more likely you will lose performance. How much, I dont know, but its probably a mathematical way to find it out the theoretical overhead, but then again, real life may prove it to be a bigger performance issue.

    On all my xen installations, “disc I/O” is my main concern. I see when one system is doing a lot of disk swapping, dom0 is affected, and other domU’s get slower disk access.

    So if you use alot of disc I/O, and you have performance issues, you should look into ways on how to optimize how domU’s read and write to disk.

    My guess is that the Redhat 5/CentOS 5 way is “ok”. I use it in production, and I have no issues. But I do see that disc I/O is slow, seen from the domU.

    Best Regards,


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s