← Back to Dashboard

Recovery and Expansion of a 100% Full LVM Disk

CRITICAL: LVM and filesystem resize commands require a small amount of free space to write metadata. If the disk is truly at 100%, these commands may fail unless you clear space first.

Phase 1 Emergency Space Recovery

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/*

Phase 2 Physical Volume (PV) Expansion

Before the OS can see extra space, update the LVM Physical Volume layer.

Scenario A: Resizing an existing partition

# 1. Resize the partition table
sudo growpart /dev/xvda 3

# 2. Update LVM metadata
sudo pvresize /dev/xvda3

Scenario B: Adding a brand new disk

# 1. Initialize for LVM
sudo pvcreate /dev/xvdb

# 2. Add to Volume Group
sudo vgextend centos /dev/xvdb

Phase 3 Extending the Logical Volume (LV)

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

Phase 4 Expanding the Filesystem

Final step: Grow the filesystem so the OS recognizes the capacity. Identify type via df -T.

Option A: XFS (RHEL/CentOS 7+)

# XFS uses the MOUNT POINT
sudo xfs_growfs /

Option B: Ext4 (Ubuntu/Debian)

# Ext4 uses the DEVICE PATH
sudo resize2fs /dev/mapper/centos-root

Phase 5 Verification

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%.