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