Scenario: In the Dom0 (Host) you have an LVM Logical Volume that you export to the DomU (Guest) and it appears as an entire hard drive which you want to make larger.

Example- Dom0: /dev/VolGroup00/LogVol00 -> DomU: /dev/xvda


Resizing an LVM Logical Volume used as a DomU drive

A Logical Volume used as a DomU drive will appear in the DomU as /dev/xvda. A Logical Volume used as a DomU partition will appear in the DomU as /dev/xvda1. Please note the difference.

The disk line in the Xen Domain config file stored in /etc/xen on the Dom0 will look something like this.

disk = ['phy:vgsys/lvvirt,xvda,w']

Get the Logical Volume name and path in Dom0

On the Dom0 we need to expand the Logical Volume. We start by using the lvdisplay command to get the path to the Logical Volume

[ root@vs /srv/xen ] lvdisplay
--- Logical volume ---
LV Name                /dev/vgsys/lvvirt
VG Name                vgsys
LV UUID                XMWzWW-oZih-A5uH-91Sa-7l1y-8cqf-18KcNB
LV Write Access        read/write
LV Status              available
# open                 1
LV Size                60.00 GB
Current LE             1920
Segments               2
Allocation             inherit
Read ahead sectors     auto
- currently set to     256
Block device           253:2

Here's how I created a Ubuntu domU in Centos dom0:
dd if=/dev/zero of=/vm/Ubuntu-Hardy-base.img bs=1024k count=4000
dd if=/dev/zero of=/vm/Ubuntu-Hardy-swap.img bs=1024k count=400
/sbin/mkfs.ext3 /vm/Ubuntu-Hardy-base.img
/sbin/mkfs.ext3 /vm/Ubuntu-Hardy-swap.img
/sbin/mkswap /vm/Ubuntu-Hardy-swap.img
chmod 640 /vm/Ubuntu*
mkdir /mnt/xenfs
mount -o loop /vm/Ubuntu-Hardy-base.img /mnt/xenfs
rpm -Uvh debootstrap*
export PATH=$PATH"/usr/sbin":/sbin  (so chroot will not fail)
/usr/sbin/debootstrap --arch i386 --include=linux-image-2.6.24-
16-generic,linux-image-2.6.24-16-xen,linux-ubuntu-modules-2.6.24-16-xen,linux-image-xen,libc6-xen,grub --components=main,universe,multiverse hardy /mnt/xenfs


chroot /mnt/xen or just make xure all edits go to /mnt/xenfs/ from this point on:

mv /lib/tls /lib/tls.disabled

create /edit /etc/fstab

proc            /proc           proc    defaults        0       0
/dev/hda1       /               ext3    defaults,errors=remount-ro 0       1
/dev/hda2       none            swap    sw              0       0

# mkdir -p /boot/grub
# update-grub

edit /boot/grub/menu.lst

title           Ubuntu 8.04, kernel 2.6.24-16-xen
root            (hd0,0)
kernel          /boot/vmlinuz-2.6.24-16-generic root=/dev/xvda1 ro console=xvc0
initrd          /boot/initrd.img-2.6.24-16-xen

title           Ubuntu 8.04, kernel 2.6.24-16-xen (recovery mode)
root            (hd0,0)
kernel          /boot/vmlinuz-2.6.24-16-xen root=/dev/xvda1 ro single console=xvc0
initrd          /boot/initrd.img-2.6.24-16-xen

# cd /etc/event.d
# cp tty1 xvc0
# sed -i -e "s/tty1/xvc0/g" xvc0

Add xvc0 to /etc/securetty to allow root to login

# update-rc.d -f hwclockfirst remove
# update-rc.d -f hwclock remove
# rm /etc/udev/rules.d/85-hwclock.rules

Now download the updated linux-image and headers from
and install them, otherwise no network when you boot the domU

Create our guest config file :
bootloader = '/usr/bin/pygrub'
memory = 512
name = "Ubuntu-Hardy-Base"
disk = ['file:/vm/Ubuntu-Hardy-base.img,hda1,w','file:/vm/Ubuntu-Hardy-swap.img,hda2,w']
vif = [ '' ]

Boot the domU.

Hope this helps




First we'll need to make a disk image for our VOIP server.

dd if=/dev/zero of=/srv/xen/voipserver.img bs=1024 count=5000000


NOTE! I have not tried this rpm kernel! Until I get to it take it as a howto with no possible gaurantee. I will get to testing it extensively the first week of September as I'm on vacation.



I just did a howto on compiling Xen 3.2.1 for CentOS5 but then I found this kernel and Xen rpms that you can just download and install.


For x86_64

  1. wget
  2. tar -xvpf TurboGate-HTools-1.2-rhel5-x86_64.tar
  3. cd TurboGate-HTools-1.2-rhel5-x86_64/
  4. rpm -ivh *.rpm
  5. reboot and select new kernel at grub prompt

For i386

  1. wget
  2. tar -xvpf TurboGate-HTools-1.2-rhel5-i386.tar
  3. cd TurboGate-HTools-1.2-rhel5-i386/
  4. rpm -ivh *.rpm
  5. reboot and select new kernel at grub prompt

I haven't as of yet used this new kernel and Xen but it might make it a lot easier than compiling Xen 3.2.1 from scratch.



I thought about updating this to include Xen 3.3 but in all reality the gitco repositories work great for i386 and x86_64 so I don't see a reason to compile xen. However, I'm leaving this up in case someone wants to use it as a loose guide to compile xen 3.3.1.

CentOS 5.2/RHEL 5.2 comes with a very highly modified Xen 3.03 which if I'm correct is in fact Xen 3.1 backported. If you want to use the latest Xen 3.2.1 you need to update the hypervisor. This tutorial is for x86_64 because that's what I'm running on If you want the 32 bit version modify the appropriate paths and file names.

  1. rpm -i 2> /dev/null
  2. cd /usr/src/redhat/SOURCES ; wget
  3. vi ../SPECS/xen.spec
  4. - Change "Version: 3.2.0" to "Version 3.2.1"
  5. - Change "Source0: xen-3.2.0.tar.gz" to "Source0: xen-3.2.1.tar.gz"
  6. - Uncomment "# /usr/lib/xen/boot/hvmloader"
  7. yum -y install transfig texi2html tetex-latex gtk2-devel libaio-devel gnutls-devel
  8. cd /usr/src/redhat/SPECS ; rpmbuild -ba ./xen.spec
  9. Grab some coffee...

... after the rpms are built do this

  1. vi /etc/yum.conf and temporarily set "gpgcheck=0" to "gpgcheck=1" since RPMs aren't signed.
  2. cd /usr/src/redhat/RPMS/x86_64 ; yum -y install xen-3.2.1-0xs.x86_64.rpm xen-libs-3.2.1-0xs.x86_64.rpm xen-devel-3.2.1-0xs.x86_64.rpm
  3. vi /etc/yum.conf and set gpgcheck back to "gpgcheck=1".
  4. edit /boot/grub/grub.conf and switch all references of /boot/xen-3.1.. to /boot/xen-3.2..

Now you can reboot and enjoy your new Xen 3.2.1.



If you're moving from a real server installation to a VirtualBox virtualized configuration you may want to take your real physical disk and just turn it into a virtual disk. There are advantages to creating a new disk and rsyncing your OS into it but this tutorial will show you how to make an exact copy of it. Note the exact copy will be the same size as the real physical disk so make sure you have enough drive space. This is most useful for Operating System images with shared storage for data. I wouldn't advise anyone to make a 1TB copy of their new drive and turn it into a VDI file!

To get the image from the disk use the dd command.

  1. dd if=/dev/hda of=./hda.img
  2. VBoxManage convertdd hda.img hda.vdi
grant@workstation:~$ dd if=/dev/hda of=./hda.img
grant@workstation:~$ VBoxManage convertdd hda.img hda.vdi
VirtualBox Command Line Management Interface Version 1.6.0
(C) 2005-2008 Sun Microsystems, Inc.
All rights reserved.

Converting VDI: from DD image file="hda.img" to file="hda.vdi"...
Creating fixed image with size 1024966656 bytes (978MB)...

This will make an exact copy of /dev/hda to the raw image file hda.img. Then VBoxManage will convert the raw disk hda.img to hda.vdi for use with VirtualBox.

I this tutorial we'll set up a Xen domU specifically for Zimbra because it likes to take over an entire machine. We'll also set up authenticated mail sending via gmails smtp servers and configure our router to forward requests to the appropriate domU. Lastly we'll use Apache on another machine (virtual or not) to proxy web connections to our DomU.


You will want to follow the Create a Centos virtual machine on Xen tutorial before continuing with these instructions. Once you have created your Xen Virtual Machine running CentOS5 proceed with this tutorial.


Preparing for installation

Before you install Zimbra you want to set the network settings and hostname. I would advise you to set a static IP address for the Virtual Machine as well as setting the hostname to something unique. If this Virtual Machine is behind a NAT you'll get errors about the DNS name not being able to be resolved. We can edit the /etc/hosts to get rid of those.





Edit system network settings - set IP address, Netmask etc.. and set the current hostname

service network restart

Shut down Sendmail to avoid conflicts on port 25

service sendmail stop
chkconfig sendmail off

Before installing Zimbra we'll install some of it's dependencies.

yum install fetchmail gmp compat-libstdc++-296 compat-libstdc++-33 libtool-ltdl 

Installing Zimbra

We need to download Zimbra in order to install it.



A lot of this tutorial was stolen from the CentOS wiki - I've shortened it by quite a bit to make it easier.  I assume you know this already but you will need to be logged in as root or have root privileges in order to execute this tutorial.

Creating an Image

The first step is to create an image that will hold the domU virtual disk. Since this can just be a file filled with zeros, our usual friend dd comes in handy.  The following command will create a /srv/xen/centos5.img file of 11GB, although the actual data blocks are allocated in a lazy fashion meaning that the disk image doesn't actually take up the whole 11GB until you fill it up. This is referred to as a sparse file.


dd if=/dev/zero of=/srv/xen/centos5.img oflag=direct bs=1M seek=10240 count=1


Preparing the Xen configuration file for installation

Xen uses one configuration file per domain. The configuration for the domain will be slightly different during the installation, because we have to provide installation kernels, and possibly some boot parameters. Here we download the installation kernel, ramdisk and xen config file.

Page 8 of 9