How to Mount Linux LVM Partition in a XenServer Host

  • CTX117791
  • Created onMar 26, 2014
  • Updated onSep 02, 2014
Article Topic Installation/Upgrade


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

Automatic translation

Important: Non-English versions of this article are translated by an automatic translation system (also referred to as Machine Translation, or MT) and have not been translated or reviewed by a person. Citrix offers a machine translated version of this article to allow for greater access to the support content. However, automatic translation is not always perfect and may contain vocabulary, syntax or grammar errors. Citrix is not responsible for inconsistencies, errors or damage incurred as a result of the use of machine translated articles. Thank you.

Traduction automatique

Important : cet article a été traduit par un système de traduction automatique (également appelé Traduction automatique ou TA) et n'a pas été vérifié par des spécialistes. Citrix propose une traduction automatique de cet article afin de permettre à toute personne ne maîtrisant pas l'anglais d'accéder au contenu de l'assistance. Toutefois, la traduction automatique n'étant pas parfaite, elle peut contenir des erreurs de terminologie, de syntaxe ou de grammaire. Citrix n'est pas responsable des incohérences, erreurs ou dommages pouvant résulter de l'utilisation par nos clients d'articles TA.

Automatische vertaling

Belangrijk: Dit artikel is vertaald door een automatisch vertalingssysteem (ook Machine Translation of MT genoemd) en is niet vertaald of beoordeeld door mensen. Citrix biedt een machine-vertaalde versie van dit artikel aan om een betere toegang mogelijk te maken tot de support-inhoud. Automatisch vertalen werkt echter niet altijd perfect en het resultaat kan fouten bevatten in de woordkeuze, syntaxis of grammatica. Citrix is niet verantwoordelijk voor inconsistenties, fouten of schade als gevolg van het gebruik van MT-artikelen door onze klanten.

Maschinelle Übersetzung

Wichtig: Dieser Artikel wurde mit einem maschinellen Übersetzungssystem und ohne jegliche Bearbeitung durch Personen übersetzt. Citrix bietet maschinelle Übersetzungen von Artikeln an, damit Benutzer umfassenden Zugriff auf Support-Inhalte haben. Maschinelle Übersetzungen enthalten jedoch möglicherweise Fehler in Bezug auf Terminologie, Syntax und Grammatik. Citrix übernimmt keine Verantwortung für Inkonsistenzen, Fehler oder Schäden, die aus der Verwendung von maschinell übersetzten Artikeln durch Kunden resultieren.


重要提示:本文是由自动翻译系统翻译完成的(也称为“机器翻译”或 MT),未经人工翻译或审查。Citrix 提供本文的机器翻译版本是为了方便更多人访问支持内容。然而,自动翻译的文章并不总是完美的,可能存在词汇、语法或文法方面的错误。对于因客户使用机器翻译文章导致出现的不一致、错误或损害,Citrix 不承担任何责任。



Tradução automática

Importante: este artigo foi traduzido por um sistema de tradução automática (também conhecido por Machine Translation ou MT) e não foi traduzido nem revisado por pessoas. A Citrix oferece uma versão traduzida por máquina deste artigo para permitir maior acesso ao conteúdo de suporte. No entanto, a tradução automática não é sempre perfeita, podendo conter erros de vocabulário, sintaxe ou gramática. A Citrix não se responsabiliza por inconsistências, erros ou danos incorridos como resultado do uso de artigos de MT de nossos clientes.

Traducción automática

Importante: Este artículo ha sido traducido por un sistema de Traducción automática (también llamada MT o Machine Translation) sin intervención de un traductor humano. Citrix ofrece la traducción automática de este artículo para ampliar el acceso a la información de asistencia técnica. No obstante, la traducción automática no es perfecta y puede contener errores de vocabulario, sintaxis y gramática. Citrix no se hace responsable de cualquier imprecisión, error o daño ocasionados por el uso que hagan nuestros clientes de los artículos traducidos automáticamente.
Was this helpful?
Thank you for your feedback

Share your comments or find out more about this topic

Citrix Forums