Skip to main content
Resizing a Linux Filesystem Live with LVM (No Downtime)

Resizing a Linux Filesystem Live with LVM (No Downtime)

KU
· Founder & Chief Editor
• 8 min read•Updated •

The disk is full and the app is still running. Here is how to grow a logical volume and its filesystem underneath live workloads, safely.

Key takeaways

  • You can grow an LVM-backed filesystem while it stays mounted.
  • Check vgs for free space, run lvextend to grow the logical volume, then resize2fs for ext4 or xfs_growfs for XFS, or do both at once with lvextend -r.
  • Confirm with df -h.
  • Shrinking is different: ext4 only offline, XFS effectively never.

To grow a full LVM filesystem with no downtime, run sudo lvextend -r -L +40G /dev/vg_data/lv_data. That extends the logical volume and grows the mounted ext4 or XFS filesystem in one step. If the volume group has no free space, add a disk with pvcreate and vgextend first. Confirm with df -h.

Verified against

lvm2 2.03.43 (latest lvmteam tag), e2fsprogs and xfsprogs man pages as published on man7.org (August 2026 snapshots), against the lvextend(8), lvreduce(8), resize2fs(8) and xfs_growfs(8) man pages. Checked October 2026.

df -h shows 100% and the app is still serving traffic. The grow is three independent operations (volume group, logical volume, filesystem), and mixing up their order is the most common way this goes wrong, so this walks through each one and what confirms it worked before moving to the next.

Check what you're actually working with first

Bash
df -h /data
Filesystem                    Size  Used Avail Use% Mounted on
/dev/mapper/vg_data-lv_data    50G   50G     0 100% /data

lsblk
NAME                    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda                       8:0    0  100G  0 disk
├─sda1                    8:1    0    1G  0 part /boot
└─sda2                    8:2    0   99G  0 part
  └─vg_data-lv_data     253:0    0   50G  0 lvm  /data

vgs
  VG      #PV #LV #SN Attr   VSize   VFree
  vg_data   1   1   0 wz--n-  99.00g  49.00g

That last line is the answer to "do I even need a new disk": VFree shows 49G already sitting unused in the volume group. Nothing needs to be attached. The space is there, it's just not allocated to the logical volume yet.

If VFree were closer to 0, you'd attach a new disk or cloud volume, then bring it into the volume group before continuing:

Bash
sudo pvcreate /dev/sdb
sudo vgextend vg_data /dev/sdb

Extend the logical volume

Bash
sudo lvextend -L +40G /dev/vg_data/lv_data
  Size of logical volume vg_data/lv_data changed from 50.00 GiB to 90.00 GiB.
  Logical volume vg_data/lv_data successfully resized.

-L +40G adds 40G to the current size. To use everything free in the volume group instead of a fixed number, use -l +100%FREE:

Bash
sudo lvextend -l +100%FREE /dev/vg_data/lv_data

At this point the block device is bigger, but the filesystem sitting on it has no idea; df still reports the old size. This is the step people stop at and then wonder why nothing changed.

The shortcut is -r (--resizefs), which the lvextend man page describes as resizing the underlying filesystem together with the LV using fsadm. We use it for routine grows; the separate steps below are what it does for you, and what to run when fsadm is missing or you want to watch each stage:

Bash
sudo lvextend -r -l +100%FREE /dev/vg_data/lv_data

Grow the filesystem to match

The command depends on the filesystem type, and both of these work on a mounted, live filesystem:

Bash
# ext4
sudo resize2fs /dev/vg_data/lv_data
Filesystem at /dev/vg_data/lv_data is mounted on /data; on-line resizing required
The filesystem on /dev/vg_data/lv_data is now 23592960 (4k) blocks long.

# XFS: grows a mounted filesystem, addressed by its mount point
sudo xfs_growfs /data

The classic advice is "resize2fs takes the device, xfs_growfs takes the mount point." Current xfsprogs accepts either a mount point or the block device of a mounted XFS filesystem, but the filesystem must be mounted to grow at all, which is the opposite of ext4 shrinking. We still pass the mount point, because it fails loudly if nothing is mounted there. Not sure which filesystem you have? lsblk -f shows it, and our ext4 vs XFS vs Btrfs comparison covers why it matters here.

Confirm before you move on

Bash
df -h /data
Filesystem                    Size  Used Avail Use% Mounted on
/dev/mapper/vg_data-lv_data    89G   50G   35G  57%  /data

Don't trust the previous step's "success" output alone. df on the live mount is the real confirmation. If it still shows the old size after resize2fs/xfs_growfs reported success, the mount you resized and the mount you're checking may not be the same device (common with bind mounts or a stale NFS cache); recheck lsblk and mount | grep /data before doing anything else.

Shrinking is a different, riskier operation

Everything above only grows. Shrinking works in the opposite order (filesystem first, then logical volume), and it is much easier to lose data if you get it wrong:

  • XFS cannot be shrunk in any practical sense. The xfs_growfs man page notes that only shrinking the last allocation group without removing it is implemented. The real path is backup, recreate, restore.
  • ext4 can be shrunk, but only unmounted, and only with resize2fs given an explicit target size smaller than the current filesystem, run before lvreduce, never after. Shrinking the logical volume before the filesystem has been told to release that space truncates live data.
Bash
# ext4 shrink: offline, filesystem first, LV second, in that order
sudo umount /data
sudo e2fsck -f /dev/vg_data/lv_data
sudo resize2fs /dev/vg_data/lv_data 40G
sudo lvreduce -L 40G /dev/vg_data/lv_data
sudo mount /data

If a filesystem needs to shrink and it's XFS, there usually isn't a clean answer short of migrating the data to a smaller volume. Plan for that with headroom rather than discovering it during an incident.

Snapshot before anything that isn't a pure grow

LVM snapshots are cheap and this is exactly the scenario they exist for:

Bash
sudo lvcreate -L 5G -s -n lv_data_snap /dev/vg_data/lv_data
# ... do the risky operation ...
sudo lvremove /dev/vg_data/lv_data_snap   # once confirmed good

A snapshot isn't a substitute for a real backup (it lives on the same volume group and disappears if the underlying storage fails), but it's a fast rollback path for "this shrink or filesystem operation went wrong five minutes ago," which covers most of the actual risk in these commands.

The fix in order

  1. Check vgs for free space before touching anything; you may not need a new disk at all.
  2. Grow: lvextend on the logical volume, then resize2fs (ext4) or xfs_growfs (XFS, mount point not device) on the filesystem. Both work live.
  3. Confirm with df -h on the actual mount, not just the command's own success message.
  4. Shrink (ext4 only, XFS can't): unmount, resize2fs to the smaller target first, lvreduce second, since reversing that order risks data loss.
  5. Snapshot before any shrink or filesystem-type-specific operation you haven't run before on this box.

This pairs with diagnosing disk full on Linux when the question is what's eating the space in the first place, not just how to add more of it.

Questions people ask

Can I resize a logical volume without unmounting?

Yes, for growing. lvextend works on an active logical volume, and both resize2fs (ext4) and xfs_growfs (XFS) grow a mounted filesystem. lvextend -r does both steps in one command. Shrinking is the exception: ext4 must be unmounted and checked with e2fsck -f first, and XFS cannot be meaningfully shrunk at all, so plan a migration instead.

Why does df still show the old size after lvextend?

Because lvextend only grows the block device. The filesystem on top still believes it is the old size until you run resize2fs for ext4 or xfs_growfs for XFS, or until you use lvextend -r, which calls fsadm to do it. If df -h is still wrong after a successful resize, check lsblk and mount to confirm you resized the device actually mounted at that path.

Is lvextend -r safe on a live system?

For grows, yes; it is the same online resize you would run by hand, wrapped by fsadm. It saves you from the most common mistake, extending the volume and forgetting the filesystem. We don't lean on automation for shrinking: ext4 has to be unmounted, and XFS can't really shrink. Take a snapshot before anything other than a plain grow.

The call we'd make

Keep 15-20% headroom in the volume group on any disk-sensitive box so a grow is always the lvextend + resize path above: five minutes, zero downtime, reversible via snapshot if something looks wrong. Treat shrinking as a planned migration, not a live operation, especially on XFS where it's not an option at all.

Sources

Explore topics:Linux
React
Share this post
Cite this article
Plain text

Kiril Urbonas (2026). Resizing a Linux Filesystem Live with LVM (No Downtime). DevOpsNess. Updated 2026-10-31. https://www.devopsness.com/blog/lvm-resize-filesystem-live

Markdown

[Resizing a Linux Filesystem Live with LVM (No Downtime)](https://www.devopsness.com/blog/lvm-resize-filesystem-live) (Kiril Urbonas, DevOpsNess, updated 2026-10-31)

KU

Kiril Urbonas

Founder & Chief Editor

607 articles
View all articles by Kiril Urbonas

You might have missed

Evergreen posts worth revisiting.