A monitoring alert fires: /var on a production VM is at 92%. The application is still serving traffic. The right move is to grow the volume online, not to unmount and panic. On a cloud VM with LVM in the middle, the operation is routine — provided every layer is grown in order and the filesystem on top supports an online resize.
What’s actually happening
A cloud VM disk is a chain of layers: the cloud-provided block device (/dev/sdb or /dev/nvme1n1), a partition table or raw device, an LVM physical volume, a volume group, a logical volume, and a filesystem. Growing the visible filesystem requires growing every layer below it. Skipping a layer is the single most common reason a “disk extension” call gets stuck — the disk has been resized at the hypervisor but the kernel still sees the old size, or LVM has not been told the PV has more room.
Both ext4 and xfs support online growth. Online shrinks are a different story (ext4 only, and not while mounted) — this article is only about growing.
How to verify
Confirm each layer’s current size before doing anything:
lsblk
df -hT /var
pvs && vgs && lvs
After the cloud provider has expanded the underlying disk, the kernel may not see the new size yet. Force a rescan:
echo 1 | sudo tee /sys/class/block/sdb/device/rescan
For an NVMe device:
echo 1 | sudo tee /sys/class/block/nvme1n1/device/rescan_controller
lsblk should now show the larger size on the block device but the old size on the PV. That gap is what the next steps close.
The fix
If the PV is on a partition (e.g. /dev/sdb1), grow the partition first with growpart /dev/sdb 1 (from cloud-utils-growpart). If the PV is on the whole device, skip this step.
Then extend the PV, the LV, and the filesystem:
sudo pvresize /dev/sdb1 # or /dev/sdb if no partition
sudo lvextend -l +100%FREE /dev/mapper/vg0-var
sudo resize2fs /dev/mapper/vg0-var # for ext4
# or
sudo xfs_growfs /var # for xfs (path, not device)
Confirm with df -hT /var. The mount stays online throughout — open file handles are not interrupted.
If the LV is being grown to make room for a database that has not yet exhausted free space, do it now while the system is calm, not at 99%. The procedure is the same; the on-call experience is not.
Stack Harbor monitors disk pressure as part of Cloud Compute day-2 operations. If a growth touches a database volume, we coordinate the window.