Educational ICT Virtualisation Specialist

Twitter LinkedIn E-mail
Precedence Technologies Ltd
Technology House, 36a Union Lane
Cambridge, CB4 1QB, United Kingdom
T: +44 (0)8456 446 800 / +44 (0)1223 359900
E: enquiries@precedence.co.uk
XenServer-VGExpand

Jump To: Support > KB > Citrix > XenServer > VGExpand

Expanding LVM storage repository by adding extra drives (worked example)

Lenovo/IBM ServeRAID M5210 supports online capacity expansion to increase the size of a virtual drive. Unfortunately, this is not supported for RAID 10. To avoid having to destroy the virtual drive and recreate at a larger size (thus losing all data in the process), it is possible to add create an extra virtual drive and add that capacity to the storage repository.

  1. Create the new virtual drive using your on-line or off-line RAID management
  2. Look at dmesg to find the virtual drive, in this case /dev/sdd:
    [  259.157164] scsi 0:2:2:0: Direct-Access     IBM      ServeRAID M5210  4.68 PQ: 0 ANSI: 5
    [  259.157573] sd 0:2:2:0: [sdd] 1951170560 512-byte logical blocks: (999 GB/930 GiB)
    
  3. Run nano /etc/lvm/lvm.conf. Press Ctrl-W and search for metadata_read_only. Alter the metadata_read_only = 1 line to read metadata_read_only = 0 and type Ctrl-X to save:
            # Configuration option global/metadata_read_only.
            # No operations that change on-disk metadata are permitted.
            # Additionally, read-only commands that encounter metadata in need of
            # repair will still be allowed to proceed exactly as if the repair had
            # been performed (except for the unchanged vg_seqno). Inappropriate
            # use could mess up your system, so seek advice first!
            metadata_read_only = 0
    
  4. Create your new PV with pvcreate following by the device you determined above. You can check with pvdisplay:
    [root@xenserver01 ~]# pvcreate /dev/sdd
      Physical volume "/dev/sdd" successfully created
    [root@xenserver01 ~]# pvdisplay
    # 
      --- Physical volume ---
      PV Name               /dev/sdc
      VG Name               VG_XenStorage-7299b4da-46fd-d088-a909-1d040f6a859c
      PV Size               2.00 TiB / not usable 12.00 MiB
      Allocatable           yes
      PE Size               4.00 MiB
      Total PE              524285
      Free PE               52450
      Allocated PE          471835
      PV UUID               UxN4ao-U7iO-4QLN-qxXs-d4gQ-0ifU-bj77aZ
    
      --- Physical volume ---
      PV Name               /dev/sdb
      VG Name               XSLocalEXT-3ad7ce7b-5545-f170-6a86-29eb746dc8e2
      PV Size               446.10 GiB / not usable 13.00 MiB
      Allocatable           yes (but full)
      PE Size               4.00 MiB
      Total PE              114199
      Free PE               0
      Allocated PE          114199
      PV UUID               UGJjrE-yx3d-erTu-Koid-qp2E-Y0eo-t9R0Vb
    
      --- Physical volume ---
      PV Name               /dev/sda3
      VG Name               VG_XenStorage-ec222c87-7812-7ff4-5d3d-5da65664f7b0
      PV Size               1.78 TiB / not usable 14.98 MiB
      Allocatable           yes
      PE Size               4.00 MiB
      Total PE              465732
      Free PE               189741
      Allocated PE          275991
      PV UUID               hCriEm-GfqF-hr0u-G0sr-WOYZ-dtLe-gPnj4E
    
      "/dev/sdd" is a new physical volume of "930.39 GiB"
      --- NEW Physical volume ---
      PV Name               /dev/sdd
      VG Name
      PV Size               930.39 GiB
      Allocatable           NO
      PE Size               0
      Total PE              0
      Free PE               0
      Allocated PE          0
      PV UUID               jbOvYD-rKSy-aQJk-c9gP-QoOP-YNp5-3QeMPQ
    
  5. Determine the UUID of the SR you want to expand (in this case Local storage):
    [root@xenserver01 ~]# xe sr-list name-label=Local\ storage
    uuid ( RO)                : ec222c87-7812-7ff4-5d3d-5da65664f7b0
              name-label ( RW): Local storage
        name-description ( RW):
                    host ( RO): xenserver01
                    type ( RO): lvm
            content-type ( RO): user
    
  6. View the current properties using vgdisplay by appending the SR UUID onto VG_XenStorage-:
    [root@xenserver01 ~]# vgdisplay VG_XenStorage-ec222c87-7812-7ff4-5d3d-5da65664f7b0
      --- Volume group ---
      VG Name               VG_XenStorage-ec222c87-7812-7ff4-5d3d-5da65664f7b0
      System ID
      Format                lvm2
      Metadata Areas        1
      Metadata Sequence No  9158
      VG Access             read/write
      VG Status             resizable
      MAX LV                0
      Cur LV                38
      Open LV               0
      Max PV                0
      Cur PV                1
      Act PV                1
      VG Size               1.78 TiB
      PE Size               4.00 MiB
      Total PE              465732
      Alloc PE / Size       275991 / 1.05 TiB
      Free  PE / Size       189741 / 741.18 GiB
      VG UUID               GzfTxt-NYud-uajR-fZZ5-hCo5-jSrQ-VqeWI0
    
  7. Extend the VG using vgextend using the VG name and device name as arguments:
    [root@xenserver01 ~]# vgextend VG_XenStorage-ec222c87-7812-7ff4-5d3d-5da65664f7b0 /dev/sdd
      Volume group "VG_XenStorage-ec222c87-7812-7ff4-5d3d-5da65664f7b0" successfully extended
    [root@xenserver01 ~]# vgdisplay VG_XenStorage-ec222c87-7812-7ff4-5d3d-5da65664f7b0
      --- Volume group ---
      VG Name               VG_XenStorage-ec222c87-7812-7ff4-5d3d-5da65664f7b0
      System ID
      Format                lvm2
      Metadata Areas        2
      Metadata Sequence No  9159
      VG Access             read/write
      VG Status             resizable
      MAX LV                0
      Cur LV                38
      Open LV               0
      Max PV                0
      Cur PV                2
      Act PV                2
      VG Size               2.69 TiB
      PE Size               4.00 MiB
      Total PE              703911
      Alloc PE / Size       275991 / 1.05 TiB
      Free  PE / Size       427920 / 1.63 TiB
      VG UUID               GzfTxt-NYud-uajR-fZZ5-hCo5-jSrQ-VqeWI0
    
  8. Rescan the SR either from XenCenter or from the CLI:
    [root@xenserver01 ~]# xe sr-scan uuid=ec222c87-7812-7ff4-5d3d-5da65664f7b0
    
  9. Revert your changes to lvm.conf by running nano /etc/lvm/lvm.conf. Press Ctrl-W and search for metadata_read_only. Alter the metadata_read_only = 0 line to read metadata_read_only = 1 and type Ctrl-X to save
© Copyright Precedence Technologies 1999-2024
Page last modified on June 01, 2018, at 12:47 PM by sborrill