XenServer 6_2_0,XenServer 6_1_0,XenServer 6_0
This article describes how to mount a Linux Logical Volume Manager (LVM) partition located inside a virtual disk (VDI) in a XenServer Host. If a Linux ...


This article describes how to mount a Linux Logical Volume Manager (LVM) partition located inside a virtual disk (VDI) in a XenServer Host.

If a Linux Virtual Machine (VM) with an LVM partition crashes, then the LVM partition cannot be accessed directly with kpartx. Red Hat Enterprise Linux (RHEL) 5 by default uses LVM for installing the root partition.


To mount a Linux Logical Volume Manager (LVM) partition, complete the following procedure:

  1. Check for the universal unique identifier (UUID) of the virtual machine using the following commands:
    # xe vm-list name-label=<vm-name>
    # xe vm-disk-list uuid=<vm-uuid>

    Note: You will need the VDI-UUID later as this is the disk which has the LVM partition or partitions.
  2. Run kpartx command to create loop devices for the partitions inside the Logical volume.

  3. Find out the LV volume file that is related to the particular VDI listed in the previous step:
    # xe sr-list type=lvm

  4. Use the SR-UUID where the VDI is located to find out the volume group (VG) and activate all LVs in that group:
    # vgchange –ay VG_XenStorage-<sr-uuid>

  5. List all disks in that VG group:
    # ll /dev/VG_XenStorage-<sr-uuid>

  6. Map the LV using the kpartx command. This is the VDI disk of the particular virtual machine:
    # kpartx –a /dev/VG_XenStorage-<sr-uuid>/LV-<vdi-uuid>

  7. Check the mapped partitions in /dev/mapper to validate LV-<vdi-uuid>p<partition_number>.
    # ll /dev/mapper

    For example:

    # LV-c4d1f0af-b0c4-413c-8832-2c1bfd90d118p1
    # LV-c4d1f0af-b0c4-413c-8832-2c1bfd90d118p2

  1. The following command scans partitions for LVM and adds this new volume group to the XenServer Host. Run the following command to see the VG name related to /dev/mapper:
    # pvscan

  1. Run the following command to see all VGs name inside the virtual machine:
    # vgscan

    For example:

    If the VG inside the virtual machine was named as system, should see a similar row:
    # Found volume group “system” using metadata type lvm2

  1. Use the following commands to make all logical volumes in the group active:
    # lvchange -ay <vg-name>
    (same VG name from the previous command)
    For example:
    # lvchange –ay system

  1. Verify the volume group has active logical volumes listed as follows:
    # lvscan

    A similar output appears to include VG system with two partitions:

    # ACTIVE ‘/dev/system/root’ [7.43 GB] inherit
    # ACTIVE ‘/dev/system/swap’ [512.00 MB] inherit

  1. Create a directory, mount this logical volume, and access its data using the following commands:
    # mkdir /mnt/partition
    # mount /dev/<vg-name>/<partition> /mnt/partition
    # cd /mnt/partition
    # ls

Reverse Procedure

To unmount a mounted devise, complete the following procedure:

  1. Run the following command to unmount mounted devices:
    # umount /mnt/disk

  1. Deactivate the logical volumes on the VG:
    # vgchange –an <VG-name>

  1. Delete partition mappings with kpartx:
    # kpartx –d /dev/ VG_XenStorage-<sr-uuid>/LV-<vdi-uuid>
    This is similar to the previous command except for the option which has changed from “-a” to “-d”

    Note: Deactivate all LV in the group, otherwise the command will fail.

Additional Resources

To prevent file system errors, use check disk before mounting the partition (before proceeding with step 9). This applies only to EXT3 file systems:
# fsck.ext3 /dev/<vg-name>/<partition>

For example: # fsck.ext3 /dev/system/root


Join the conversation

Citrix Discussions

Open a case

Citrix Support