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-10.0.0.123’ for the VM we will create:
# lvcreate -L20480 -n 'vm-10.0.0.123' 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:
name="lvm-backed-domainu" vcpus=2 memory=2048 disk=['phy:mapper/vg_xen-vm--10.0.0.123,xvda,w'] # disk=['phy:vg_xen/vm-10.0.0.123,xvda,w'] vif=['bridge=eth0'] bootloader="/usr/bin/pygrub" on_reboot='restart' on_crash='restart'
or for installing a new DomU:
name="F12INSTALL" vcpus=2 memory=2048 disk=['phy:mapper/vg_xen-vm--10.0.0.123,xvda,w'] # disk=['phy:vg_xen/vm-10.0.0.123,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 “10.0.0.123”, memory is 2G, CPU number is 2, VBD is LV /dev/mapper/vg_xen/vm-10.0.0.123. The “disk” line specifies that we will use logical volume
vm-10.0.0.123 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]].