Setting Up LVM Backed Xen DomU

LVM volumes as backing for DomU’s file system is an appealing solution to Xen VBD. LVM volumes can dynamically grow/shrink and snapshot. These features make it simple and fast to duplicate DomU and adding storage to DomU. Creating LVM-backed Xen DomU is introduced in this post.

Create LVM-backed VBD

Suppose we have a LVM volume group for Xen now:

vg_xen. Let’s create a logical volume of size 20GB named ‘vm-’ for the VM we will create:

# lvcreate -L20480 -n 'vm-' vg_xen

Please refer to

[[creating-lvm-volume-group]] for setting up LVM volume group.

The profile for LVM-backed DomU

Then we can create a profile for LVM-bakced Xen DomU using the LVM logical volume we create above:

# disk=['phy:vg_xen/vm-,xvda,w']

or for installing a new DomU:

# disk=['phy:vg_xen/vm-,xvda,w']
vif = [ 'bridge=eth0' ]
kernel = "/lhome/xen/f12install/vmlinuz"
ramdisk = "/lhome/xen/f12install/initrd.img"
on_reboot = 'restart'
on_crash = 'restart'

The virtual machine’s name is “”, memory is 2G, CPU number is 2, VBD is LV /dev/mapper/vg_xen/vm- The “disk” line specifies that we will use logical volume

vm- in volume group vg_xen for this DomU’s VBD. Then we can install operating system in the DomU. Please refer to the “Install Fedora 12 Linux via Internet” section in: [[setting-up-stable-xen-domu-with-fedora-unmodified-fedora-12-on-top-of-xenified-fedora-12-dom0-with-xen-4-0-0]] for installing Fedora 12 in Xen DomU.

For more tutorials about Xen, please refer to [[xen-solutions]].

Eric Ma

Eric is a systems guy. Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.


  1. Hi, Eric,

    My Volume Group is fedora_VG, and my logical volumn is vm1, I wite :

    there is error as follow:

    libxl__device_disk_set_backend: Disk vdev=xvda failed to stat:mapper/fedoraVG–vm1:no such file or directory.

    how can I solve this problem ?

    Thank you

  2. disk=[‘phy:fedora_VG/vm1,xvda,w’]

    they are all error.

    How to solve this?
    Thank you ;-)

  3. NO. this one does not work
    but if I modify it to :

    disk=[‘phy:fedora_VG/vm1, raw, xvda,w’]
    the config file is OK.

    but after that the install need a URL, I type this URL:

    the installation exit here.

    My lvs looks like this:

    LV VG ATTR LSize
    root fedora_VG -wi-ao 97G
    swap fedora_VG -wi-ao 3G
    vm1 fedora_VG -wi-a 20G

    I don’t know why attr of vm1 is only -wi-a, there is no ‘o’ here.

    1. But in the other comments, you show the one without phy: . Both are good?

      Which version of Linux and xen is the Dom0? The config file seems changed a lot. F12 is too old. You may consider a newer release if there is no specific reason to use F12.

  4. Hi, Eric,

    When I install Domain U, my config file is lvmdomu1.cfg, like this:

    name = ‘lvmdomU1’
    kernel = “/home/shhpeng/Xen-dev/vmlinuz”
    ramdisk = “/home/shhpeng/Xen-dev/initrd.img”
    disk = [‘/dev/mapper/fedora_VG-vm1, raw, xvda, rw’]
    extra = “root=/dev/xvda1”
    vif = [‘bridge=xenbr0’]
    memory = 512
    vcpus = 1
    maxvcpus = 1

    it works,

    But when I copy the config file to another file, and modify it like this:

    name = ‘lvmdomU1-run’

    disk = [‘/dev/mapper/fedora_VG-vm1, raw, xvda, rw’]
    extra = “root=/dev/xvda1″
    vif = [‘bridge=xenbr0’]
    memory = 512
    vcpus = 1
    maxvcpus = 1


    xl create -f -c

    there is error :
    Traceback (most recent call last):
    File “/usr/local/lib/xen/bin/pygrub”, line 20 , in
    import xen.lowlevel.xc
    ImportError: No module named xen.lowlevel.xc

    How can I solve this problem?
    Thank you.

  5. Hi, Eric,

    the file ”” is the configuration file when I want to boot the domain U.

    The domain U has already been installed.

    Thank you.

  6. The problem is python:

    ImportError: No module named xen.lowlevel.xc

    I solve this by :
    #make dist PYTHON_PREFIX_ARG=
    #make install PYTHON_PREFIX_ARG=

  7. Hi, Eric
    There is another problem.

    When I boot VM, the following message will display :

    PCI : Fatal : No config space access function found.

    What is this ?

    Thank you.

  8. if I login in the VM using root and I cannot modify file “/boot/grub/grub.cfg”.

    it is read only.

    How can I modify this file ?

    Thank you .

    1. It is either the Dom0 or the DomU that makes your /boot/ read-only and there are many possible reasons.

      Without knowing details of your Dom0 and DomU, the others can’t figured out what’s wrong.

  9. Hi, Eric,

    I cann’t use the Internet on domU. How can I copy a file from dom0 to LVM Backed Xen DomU ?

    Thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *