Expand ESXi CentOS 7 xfs LVM partition – no reboot needed

For the past few weeks I’ve been deploying CentOS 7 test systems in my dev environment and wanted to see what was needed to expand an existing LVM partition.  Here is the breakdown that worked for me:

  1. Add disk in vCenter to VM
  2. sudo fdisk –l | grep Disk
    1. Used for comparison later
  3. $target=(grep mpt /sys/class/scsi_host/host?/proc_name | cut -d ‘/’ -f 5)
  4. echo “- – -” > /sys/class/scsi_host/$target/scan
    1. you can tail -f /var/log/messages to monitor command in separate tmux window
  5. sudo fdisk –l | grep Disk and you should now see new device
    1. lsblk should also show new device
  6. sudo pvcreate /dev/sdX
    1. Where X is new device, look for successful message
  7. sudo vgs
    1. Check for current volume size
  8. sudo vgextend <volume group name> /dev/sdX
  9. sudo vgs to confirm expansion
  10. sudo lvs to confirm current config
  11. sudo lvextend -L +xGiB /dev/mapper/<volume group name>-<partition>
  12. sudo lvs
  13. df -hT should still show old size
  14. sudo xfs_growfs -d /dev/mapper/<volume group name>-<partition>
  15. df -hT should now display new size