Search This Blog

Extend a Linux LVM Volume on a VM - Part 1

As I mentioned in the recent Linux LVM post, there are two ways to prepare the physical volume (PV)

  • the entire disk as a PV (not recommended)
  • or creating a partition on the disk and the partition as a PV.

The step to extend a LVM volume are different on these two configuration.

Extend a LVM when the entire disk as a PV

  1. Increase the VM’s hard disk size in vSphere Client
    • If there is a VM snapshot on the disk, its size cannot be changed. Remove all the snapshots first
    • After increasing the disk size, take a snapshot as the backup
  2. Rescan the SCSI bus to verify the OS see the new space on the disk
    • ls /sys/class/scsi_host/
    • echo “- - -“ > /sys/class/scsci_host/<host_name>/scan
    • tail -f /var/log/message
    • or
    • ls /sys/class/scsi_disk/
    • each ‘1’ > /sys/class/scsi_disk/<0\:0\:0\:0>/device/rescan
    • tail -f /var/log/message
    • fdisk -l
  3. Resize the PV
    • pvs
    • pvresize </dev/sdb>
    • image
  4. Verify the VG automatically sees the new space
    • vgs
    • image
    • compare the vg_app VFree size in this screen with the one in step #3
  5. Extend the LV
    • lvextend -l +100%FREE </dev/volume_group_name>/<logical_volume_name>
    • or lvextend -L+<size> /dev/<volume_group_name>/<logical_volume_name>
    • lvs
    • image
  6. Resize the file system
    • resize2fs /dev/<volume_group_name>/<logical_volume_name>
    • df -h
    • image
  7. Remove the VM snapshot once confirming the data intact

No comments:

Post a Comment

Use WinSCP to Transfer Files in vCSA 6.7

This is a quick update on my previous post “ Use WinSCP to Transfer Files in vCSA 6.5 ”. When I try the same SFTP server setting in vCSA 6.7...