Virtual Appliances:Essential Logical Volume Management for Xen DomU Deployment
From rPath Wiki
|
Use the following information to prepare a logical volume management (LVM) environment on your Xen hypervisor host (Dom0) computer to take advantage of LVM-based virtual block devices (VBDs) with your Xen guest operating systems (DomUs). Included are instructions for re-sizing the volumes should a DomU image require more free disk space.
Configuring LVM
If you have not previously configured an LVM environment on your Dom0 computer at installation time, use these steps to enable LVM on the Dom0 computer so you can use LVM-based virtual block devices (VBDs) with your DomUs:
Establish an empty partition on the Dom0 to initialize for LVM support. Ideally, this should be a large partition for support of multiple VBDs. The following example uses the partition /dev/hdd1; substitute the value of your partition when carrying out the steps.
| Be certain that the partition you are specifying does not contain data you wish to preserve. ALL EXISTING DATA ON THE PARTITION WILL BE DESTROYED by the next step. |
First, create the physical volume:
[root@yourhost ~]# pvcreate /dev/hdd1 Physical volume "/dev/hdd1" successfully created
Next, create a volume group with a name such as vg0:
[root@yourhost ~]# vgcreate vg0 /dev/hdd1 Volume group "vg0" successfully created
After creating the volume group, configure DomUs with LVM VBDs.
Re-Sizing a Logical Volume
If you require more free space for a DomU, you can re-size using the following procedure:
First, stop the running DomU. Then, use the following commands to increase the volume size, using your DomU name in place of <DomU_name>. It is increased by 1 GB in the example (+1G; replace this value with the amount of space you need to add:
[root@yourhost ~]# e2fsck -f /dev/vg0/<DomU_name> [root@yourhost ~]# lvextend -L +1G /dev/vg0/<DomU_name> [root@yourhost ~]# resize2fs /dev/vg0/<DomU_name>
After these commands, start the DomU and note the increase in free disk space within the guest domain.
| See the Xen Users' Manual for more information on LVM-based VBDs. |
LVM-Related Links
- Users' Manual Xen v3.0 - contains a section on LVM backed VBDs
- LVM HOWTO
