Perform these actions to regain the few MBs needed for LVM metadata operations.
| Action | Command |
|---|---|
| Clear Package Cache | yum clean all or apt clean |
| Truncate Logs | find /var/log -type f -name "*.log" -exec truncate -s 0 {} + |
| Clear Temp Files | rm -rf /tmp/* |
Before the OS can see extra space, update the LVM Physical Volume layer.
# 1. Resize the partition table sudo growpart /dev/xvda 3 # 2. Update LVM metadata sudo pvresize /dev/xvda3
# 1. Initialize for LVM sudo pvcreate /dev/xvdb # 2. Add to Volume Group sudo vgextend centos /dev/xvdb
Tell the Logical Volume (the "container") to consume the new space in the Volume Group.
# Add all available free space sudo lvextend -l +100%FREE /dev/mapper/centos-root
Final step: Grow the filesystem so the OS recognizes the capacity. Identify type via df -T.
# XFS uses the MOUNT POINT sudo xfs_growfs /
# Ext4 uses the DEVICE PATH sudo resize2fs /dev/mapper/centos-root
| Level | Command | Success Criteria |
|---|---|---|
| Physical | lsblk |
Disk reflects total hardware size. |
| LVM | lvs |
LV size matches your target. |
| Filesystem | df -h / |
"Use%" is below 100%. |