Updated: 12 October 2026 · Applies to: LVM 2.03.17 and later (tested with LVM 2.03.31 on Debian 13 and a Linux 6.12 kernel; AlmaLinux 9.8 ships 2.03.33, AlmaLinux 10.2 ships 2.03.36, Ubuntu 26.04 ships 2.03.31), ext4 and XFS; notes for LVM 2.03.16 on Ubuntu 24.04
To extend a logical volume into all free space of its volume group and grow the file system in the same step, run:
sudo lvextend -r -l +100%FREE /dev/vg0/data
Replace vg0/data with your volume group and logical volume (see sudo lvs). -r (--resizefs) resizes ext4 or XFS for you, while the volume stays mounted and in use. To add a fixed amount instead, use -L +20G. Shrinking is possible only for ext4, needs a backup and is covered further down.
1. Check the free space
sudo vgs # VFree = space you can still give to volumes sudo lvs # logical volumes and their size df -hT # mounted file systems, their type and size lsblk # disks, partitions and volumes
Lab output from our test system before growing a 400 MB ext4 volume:
VG #PV #LV #SN Attr VSize VFree vg0 1 1 0 wz--n- 1020.00m 620.00m
If VFree is 0, add space to the volume group first (step 3).
2. Grow the volume with lvextend
$ sudo lvextend -r -L +200M /dev/vg0/data File system ext4 found on vg0/data mounted at /data. Size of logical volume vg0/data changed from 400.00 MiB (100 extents) to 600.00 MiB (150 extents). Extending file system ext4 to 600.00 MiB (629145600 bytes) on vg0/data... resize2fs /dev/vg0/data ... Extended file system ext4 on vg0/data. Logical volume vg0/data successfully resized.
The ways to give the size:
-L +20G: add 20 GiB.-L 50G: make the volume 50 GiB in total.-l +100%FREE: add all free space in the volume group.-l +50%FREE: add half of the free space. In our test that took a volume from 1.19 GiB to 1.34 GiB with 308 MiB free.
Do not forget the plus sign. Without it, the number is the new total size, not the amount to add. lvextend -l 100%FREE on a 600 MiB volume with 420 MiB free answered:
New size given (105 extents) not larger than existing size (150 extents)
With the plus sign the same volume grew to 1020 MiB and vgs showed VFree 0. On XFS, -r runs xfs_growfs instead, which ended with data blocks changed from 81920 to 158720 in our test.
Forgot -r?
Then the volume is bigger but the file system is not: after lvextend -L +200M without -r, df -h still showed 945M. Grow the file system afterwards, online:
sudo resize2fs /dev/vg0/data # ext4 sudo xfs_growfs /data # XFS: give the mount point
After resize2fs, df -h showed 1.2G. More on XFS in grow an XFS file system with xfs_growfs.
3. No free space in the volume group
lvextend then stops with:
Insufficient free space: 25 extents needed, but only 0 available
Add a new disk to the volume group (check the disk name with lsblk first: pvcreate wipes it):
sudo pvcreate /dev/sdb sudo vgextend vg0 /dev/sdb
Step by step for new disks: add new disks using LVM.
Or use a disk that was enlarged, which is common on virtual servers. Grow the partition, then the physical volume, then the logical volume. In our lab the disk was /dev/ubdd with the physical volume on partition 1; on a VPS the commands look like growpart /dev/sda 3 and pvresize /dev/sda3 (check the names with lsblk):
$ sudo growpart /dev/ubdd 1 CHANGED: partition=1 start=2048 old: size=1224704 end=1226751 new: size=2095071 end=2097118 $ sudo pvresize /dev/ubdd1 Physical volume "/dev/ubdd1" changed 1 physical volume(s) resized or updated / 0 physical volume(s) not resized $ sudo vgs vg1 VG #PV #LV #SN Attr VSize VFree vg1 1 1 0 wz--n- 1020.00m 424.00m
Then run lvextend -r -l +100%FREE as in step 2. growpart comes in the package cloud-utils-growpart on AlmaLinux, Rocky Linux and RHEL, and cloud-guest-utils on Ubuntu and Debian. Without LVM, see extend a root partition without LVM.
4. Extend the root volume on Ubuntu
The Ubuntu Server installer puts / on ext4 in ubuntu-vg/ubuntu-lv. According to the installer's source code, on disks between 20 GB and 200 GB that volume gets only half of the space, and at most 100 GB on larger disks, so the rest waits unused in the volume group. Give it to the root volume online:
sudo vgs ubuntu-vg sudo lvextend -r -l +100%FREE /dev/ubuntu-vg/ubuntu-lv df -h /
On other distributions the names differ: sudo lvs shows them, and df -h / shows the device mounted as / (for example /dev/mapper/vg0-root, which is the same volume as /dev/vg0/root).
5. Shrink a volume (ext4 only)
Back up first. With LVM 2.03.17 and later, lvreduce -r shrinks the file system before the volume. If the file system is mounted, it asks before it unmounts (lab output, shortened):
$ sudo lvreduce -r -L 700M /dev/vg0/data File system ext4 found on vg0/data mounted at /data. File system size (1.19 GiB) is larger than the requested size (700.00 MiB). File system reduce is required using resize2fs. File system unmount is needed for reduce. File system fsck will be run before reduce. Continue with ext4 file system reduce steps: unmount, fsck, resize2fs? [y/n]: y ... Reduced file system ext4 on vg0/data. Size of logical volume vg0/data changed from 1.34 GiB (344 extents) to 700.00 MiB (175 extents). Logical volume vg0/data successfully resized.
It unmounted the volume, ran e2fsck and resize2fs, mounted it again, and our test file's checksum was unchanged. Stop the services that use the volume first; the root file system cannot be unmounted, so shrinking / needs a rescue system. On Ubuntu 24.04 (LVM 2.03.16, which uses the older fsadm method), unmount the file system yourself before you shrink. Never use --fs ignore on a volume with data: it cuts off the end of the file system.
XFS cannot be shrunk. lvreduce normally refuses:
File system reduce is required and not supported (xfs).
Do not rely on that check. In our lab with LVM 2.03.31, lvreduce -r run right after growing an XFS volume read the old file system size, printed File system reduce is not needed, skipping and cut the volume below the file system. Never point lvreduce at an XFS volume: back up, create a smaller volume and restore into it, as in shrink an LVM volume formatted with XFS.
6. Check the result
sudo lvs df -hT /data
lvresize does the same as lvextend and lvreduce in one command (lvresize -r -l +100%FREE grew our volume to 1.88 GiB).
Good to know
- A volume with snapshots may refuse to grow; see unable to extend an LVM volume that has a snapshot.
- Take a backup or a snapshot before any shrink and before changing the root file system.
- To see every disk, partition and volume at once, see list all disks, volumes and partitions.
Official documentation: lvextend manual and lvreduce manual.
Ucartz services for this topic
- KVM VPS hosting: NVMe SSD and full root access, with Free Basic Managed Support.
- Unmanaged dedicated servers: full root access and free IPMI KVM, with Free Basic Managed Support.
- Linux server management: hardening, patching, monitoring and automation for Ubuntu, Debian, RHEL and AlmaLinux.
