This is a short note of what to do when you change size of the physical disk an LVM setup, such as the default configuration in CentOS 7.
- Modify the physical disk size
- Modify the partition size
- I used fdisk to delete the partition, then re-create with a larger size
- Reboot
- Extend the physical volume size
-
pvresize <path to enlarged partition>
-
- Extend the logical volume size
-
lvextend <lv path> -l100%FREE
-
- Extend filesystem size
-
resize2fs <lv path>
-
#If you're running CentOS 7, the default filesystem is actually XFS, not ext4. In that case:
xfs_growfs <lv path>
-
- Profit.
UPDATE 2024-12-17
I looked this trusty old article up to rezize a VM disk but kept running into the error that there was not enough free space even after doing a pvresize. In this case, I had to use -L+<increased size> instead of -l100%FREE. Not sure why 100%FREE works sometimes and doesn’t others.