Recovery and Expansion of a 100% Full LVM Disk

This guide provides a structured, fail-safe procedure for recovering a system where the root filesystem is at 100% capacity and extending it to utilize newly allocated physical disk space

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.

Action

Command

Clear Package Cache

yum clean all

Truncate Logs

find /var/log -type f -name "*.log" -exec truncate -s 0 {} +

Clear Temp Files

rm -rf /tmp/*

Note: Truncating logs is safer than deleting them, as it preserves file descriptors and avoids "file in use" issues.


Phase 2: Physical Volume (PV) Expansion

Before the Operating System can see the extra space, you must update the LVM Physical Volume layer.

Scenario A: Resizing an existing partition

If you increased the size of an existing disk (e.g., /dev/xvda):

  1. Resize the partition table: growpart /dev/xvda 3

  2. Update LVM metadata: pvresize /dev/xvda3

Scenario B: Adding a brand new disk/partition

If you attached a second disk (e.g., /dev/xvdb):

  1. Initialize for LVM: pvcreate /dev/xvdb

  2. Add to Volume Group: vgextend centos /dev/xvdb


Phase 3: Extending the Logical Volume (LV)

Now that the Volume Group has free space, you must tell the Logical Volume (the "container") to expand.

  • Command: lvextend -l +100%FREE /dev/mapper/centos-root

  • Alternative: Use -L +50G if you only want to add a specific amount.


Phase 4: Expanding the Filesystem

The final step is to grow the actual filesystem so the OS recognizes the new capacity. Identify your filesystem type first using df -T.

Option A: XFS (Standard on RHEL/CentOS 7+)

XFS must be grown using the mount point.

  • Command: xfs_growfs /

Option B: Ext4 (Standard on Ubuntu/Debian)

Ext4 must be grown using the device path.

  • Command: resize2fs /dev/mapper/centos-root

Phase 5: Verification & Summary

Verification Table

Level

Command

What to check

Physical

lsblk

Ensure the parent disk reflects the total hardware size.

LVM

lvs

Ensure centos-root size matches your target.

Filesystem

df -h /

Ensure "Avail" is positive and "Use%" is below 100%.

Master Command Reference

Layer

Action

Command

Physical

Resize Partition

growpart /dev/xvda 3

LVM

Resize PV

pvresize /dev/xvda3

LVM

Resize LV

lvextend -l +100%FREE <LV_PATH>

XFS

Grow Space

xfs_growfs <MOUNT_POINT>

Ext4

Grow Space

resize2fs <LV_PATH>

Updated on