Extend XenServer Linux Guest LVM Drive

  1. Create a snapshot of the VM to revert back if needed
  2. Shut down the VM
  3. In XenCenter, select the VM and click the Storage tab
  4. Select the disk and click Properties
  5. Enter the new size under Size and Location
  6. Power on the VM
  7. Verify the additional storage is available
    # fdisk -l
  8. Edit the expanded drive with fdisk
    # fdisk /dev/xvda
  9. View the existing partitions by typing ‘p’
  10. Create a new partition by typing ‘n’
  11. If there are less than 4 partitions, select primary.  Otherwise, select extended.
  12. Press Enter twice to use all of the free space
  13. Type ‘p’ to view the new table
  14. Type ‘t’ to change the partition type of the new partition to type ‘8e’
  15. Once the partition table looks correct, type ‘w’ to save and quit
  16. Reboot the VM
  17. Create a new LVM physical volume on the new partition
    # pvcreate /dev/xvda4
  18. Extend the volume group to include the new PV
    # vgextend vg_system /dev/xvda4
  19. Extend the logical volume to include the remaining free space in the VG
    # lvextend -l+100%FREE /dev/mapper/vg_system-lv_root
  20. Resize the filesystem to fill the free space in the LV
    # resize2fs /dev/mapper/vg_system-lv_root
  21. Verify the additional space is available
    # df -h

Leave a Reply

Your email address will not be published. Required fields are marked *