Setting Up LVM-Backed Xen DomUs
LVM logical volumes are a practical choice for Xen guest storage. They support dynamic resizing, snapshots, and efficient cloning — capabilities that make capacity management and guest provisioning straightforward compared to fixed disk images.
This guide covers creating and configuring LVM-backed virtual block devices (VBDs) for Xen DomU instances.
Creating the logical volume
Start with an existing LVM volume group. If you need to set up LVM from scratch, see the LVM documentation or relevant tutorials.
To create a 20GB logical volume for a guest VM:
lvcreate -L20G -n 'vm-10.0.0.123' vg_xen
Verify the volume was created:
lvdisplay vg_xen/vm-10.0.0.123
Configuring the Xen domain
Create a domain configuration file with the LVM volume as the root disk. The disk parameter accepts either the mapped device path or the LVM logical volume path directly.
For a running domain with an installed guest OS:
name="lvm-backed-domainu"
vcpus=2
memory=2048
disk=['phy:/dev/vg_xen/vm-10.0.0.123,xvda,w']
vif=['bridge=eth0']
bootloader="/usr/bin/pygrub"
on_reboot='restart'
on_crash='restart'
For initial domain installation with a kernel and ramdisk:
name="fedora-install"
vcpus=2
memory=2048
disk=['phy:/dev/vg_xen/vm-10.0.0.123,xvda,w']
vif=['bridge=eth0']
kernel="/path/to/vmlinuz"
ramdisk="/path/to/initrd.img"
on_reboot='restart'
on_crash='restart'
Replace /path/to/ with the actual location of your installation kernel and initrd — typically in /boot/ on the dom0 or in a dedicated installation directory.
Domain parameters explained
name: Guest domain namevcpus: Number of virtual CPUsmemory: RAM in MBdisk: Block device mapping. The format isphy:/dev/vg_name/lv_name,device_name,modedevice_nameis how the disk appears inside the guest (e.g.,/dev/xvda)modeiswfor read-write,rfor read-only
vif: Virtual network interface;bridge=eth0attaches to the dom0 bridgebootloader: Path to pygrub for booting guest filesystemskernel/ramdisk: Used during installation; omit for running domains with installed bootloaders
Working with LVM snapshots
One advantage of LVM backing is snapshot capability. Create a snapshot before major changes:
lvcreate -L5G -s -n 'vm-10.0.0.123-snapshot' vg_xen/vm-10.0.0.123
If issues occur, revert by removing the snapshot and restoring from backup, or use LVM merge if the guest is offline.
Resizing a guest volume
LVM volumes can be expanded without rebooting the guest, though the filesystem must support online growth.
To extend a logical volume by 10GB:
lvextend -L+10G vg_xen/vm-10.0.0.123
Inside the guest, resize the filesystem to use the new space:
resize2fs /dev/xvda1 # for ext4
# or
xfs_growfs / # for XFS
Installation
After creating the domain configuration, create the guest filesystem and install the OS. Xen’s pygrub can chainload GRUB from the guest’s filesystem, or you can install via network using a kernel and ramdisk from the dom0.
For network-based installation, point kernel and ramdisk to your installer media, then boot the domain:
xl create -c fedora-install.cfg
The -c flag attaches the console. Proceed with standard OS installation. Once the OS is installed and bootloader is configured, update the domain config to remove kernel and ramdisk lines and restart the domain.
Checking domain status
After creation, list active domains:
xl list
Connect to the console:
xl console lvm-backed-domainu
Detach from console with Ctrl+].
2026 Comprehensive Guide: Best Practices
This extended guide covers Setting Up LVM-Backed Xen DomUs with advanced techniques and troubleshooting tips for 2026. Following modern best practices ensures reliable, maintainable, and secure systems.
Advanced Implementation Strategies
For complex deployments, consider these approaches: Infrastructure as Code for reproducible environments, container-based isolation for dependency management, and CI/CD pipelines for automated testing and deployment. Always document your custom configurations and maintain separate development, staging, and production environments.
Security and Hardening
Security is foundational to all system administration. Implement layered defense: network segmentation, host-based firewalls, intrusion detection, and regular security audits. Use SSH key-based authentication instead of passwords. Encrypt sensitive data at rest and in transit. Follow the principle of least privilege for access controls.
Performance Optimization
- Monitor resources continuously with tools like top, htop, iotop
- Profile application performance before and after optimizations
- Use caching strategically: application caches, database query caching, CDN for static assets
- Optimize database queries with proper indexing and query analysis
- Implement connection pooling for network services
Troubleshooting Methodology
Follow a systematic approach to debugging: reproduce the issue, isolate variables, check logs, test fixes. Keep detailed logs and document solutions found. For intermittent issues, add monitoring and alerting. Use verbose modes and debug flags when needed.
Related Tools and Utilities
These tools complement the techniques covered in this article:
- System monitoring: htop, vmstat, iostat, dstat for resource tracking
- Network analysis: tcpdump, wireshark, netstat, ss for connectivity debugging
- Log management: journalctl, tail, less for log analysis
- File operations: find, locate, fd, tree for efficient searching
- Package management: dnf, apt, rpm, zypper for package operations
Integration with Modern Workflows
Modern operations emphasize automation, observability, and version control. Use orchestration tools like Ansible, Terraform, or Kubernetes for infrastructure. Implement centralized logging and metrics. Maintain comprehensive documentation for all systems and processes.
Quick Reference Summary
This comprehensive guide provides extended knowledge for Setting Up LVM-Backed Xen DomUs. For specialized requirements, refer to official documentation. Practice in test environments before production deployment. Keep backups of critical configurations and data.

Hi, Eric,
My Volume Group is fedora_VG, and my logical volumn is vm1, I wite :
disk=[‘phy:mapper/fedora_VG–vm1,xvda,w’]
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
disk=[‘phy:fedora_VG/vm1,xvda,w’]
or
disk=[‘phy:mapper/fedora_VG–vm1,xvda,w’]
or
disk=[‘/dev/mapper/fedora_VG-vm1,xvda,w’]
or
disk=[‘/dev/mapper/fedora_VG/vm1,xvda,w’]
they are all error.
How to solve this?
Thank you ;-)
This one is correct:
disk=[‘phy:fedora_VG/vm1,xvda,w’]
Show us result of ‘lvs’ if it does not work.
NO. this one does not work
disk=[‘phy:fedora_VG/vm1,xvda,w’]
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:
http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/12/Fedora/x86_64/os/
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.
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.
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 lvmdomu1.run, and modify it like this:
name = ‘lvmdomU1-run’
disk = [‘/dev/mapper/fedora_VG-vm1, raw, xvda, rw’]
extra = “root=/dev/xvda1″
bootloader=”pygrub”
vif = [‘bridge=xenbr0’]
memory = 512
vcpus = 1
maxvcpus = 1
then
xl create -f lvmdomu1.run -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.
What’s the command to start the VM with the .cfg file? Is the previous VM shutted down?
Hi, Eric,
the file ” lvmdomu1.run” is the configuration file when I want to boot the domain U.
The domain U has already been installed.
Thank you.
How did you solve it and what was the problem?
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=
Thanks for the update.
I see. You built the Xen software from the source code instead of the packages from Fedora’s repository.
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.
If the VM runs just well, I usually do not worry about that message.
“If a Linux VM is running in full PV mode then it won’t have any PCI available so that message would be perfectly normal as the kernel tries to initialize all systems.” — http://discussions.citrix.com/topic/328311-pci-fatal-no-config-space-access-function-found-centos-63-x64/
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 .
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.
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.