December 5, 2026

Extending an LVM Logical Volume: The Three Layers, and Why df Still Shows the Old Size

Three stacked trays with hard drives at the bottom and file folders at the top

A Linux server or home lab box runs out of space on /, a new disk or a bigger virtual disk gets added, and lvextend runs without complaint. Then df -h shows the same size as before. The space is there. It just went to a layer the filesystem cannot see yet. LVM stacks three layers between the disk and the files, and each one has to be told about the extra space. This post walks through all three with the commands from the LVM manual pages, and shows the filesystem step on a real ext4 image.

Video: Learn Linux TV on YouTube

Three layers between the disk and the files

PV, VG, LV

The lvm manual page opens with a one-line definition: the Logical Volume Manager provides tools to create virtual block devices from physical devices. It names the three layers:

Layer Name What it is
Bottom Physical Volume (PV) A disk or partition initialized for LVM
Middle Volume Group (VG) A collection of one or more physical volumes
Top Logical Volume (LV) A virtual block device carved out of a volume group

A filesystem, ext4 or XFS, sits on top of the logical volume. That makes four things that each have their own size: the disk or partition, the PV, the VG’s free space, and the LV, and then the filesystem inside the LV.

Extents

Space moves between the layers in fixed-size chunks called extents. The lvextend page describes extending a volume as allocating logical extents from the VG’s free physical extents. The extent size is set when the volume group is created; the vgcreate page describes the option as setting “the physical extent size of PVs in the VG.”

Server rack with blinking green lights

Look before changing anything

Three report commands

The manual lists one reporting command for each layer: pvs, vgs and lvs, which report information about physical volumes, volume groups and logical volumes. Run in order, they answer the only question that matters before resizing: where is the free space right now?

  • vgs shows a VFree column. If it is above zero, the volume group already has room and the next section can be skipped.
  • pvs shows which disks belong to which group, and whether a disk is in the group at all.
  • lsblk shows the whole stack from disk to mount point and is the quickest way to spot a disk that was added but never joined.

df -h shows the size of the filesystem, which is the last layer and the one that matters to users. Every number above it can be larger without df changing.

Two ways the space arrives

A new disk

When a second disk is installed, it becomes part of the volume group in two commands. The manual describes pvcreate as initializing a disk or partition for use by LVM, and vgextend as adding physical volumes to a volume group:

pvcreate /dev/sdb
vgextend vg01 /dev/sdb

After that, vgs shows the new disk’s capacity in VFree. Nothing on the existing disks has moved. The volume group simply has more extents to hand out.

A bigger virtual disk

In a virtual machine the usual change is different: the existing virtual disk is enlarged in the hypervisor. The extra space then appears at the end of the disk, outside the partition that holds the PV. Two more steps come first in that case: grow the partition to the end of the disk with a partitioning tool, then tell LVM the PV is bigger. The pvresize manual describes the command as resizing a PV that may already be in a VG and may have active LVs allocated on it, so it runs on a live system. Its own first example is exactly this case, labelled “Expand a PV after enlarging the partition”:

pvresize /dev/sda1

With no size given, pvresize uses the size it detects on the device. Only after that does vgs show the space as free. The same page has a safety net for the opposite direction: pvresize will refuse to shrink a PV if extents are allocated beyond the new end.

This is the step that is most often skipped. A VM disk enlarged from 40 to 80 GB, followed straight away by lvextend, fails for lack of free extents, because the volume group never heard about the extra 40.

Brown cardboard box on a white background

Growing the logical volume

Absolute or relative

lvextend takes the new size either in bytes-style units with -L or in extents with -l. The manual explains the plus sign: with + or - in front, the value is relative and added or subtracted from the current size. Without it, the value is the new total.

lvextend -L +20G vg01/root     # 20 GiB more than now
lvextend -L 60G vg01/root      # make it 60 GiB in total

The units are binary: the page notes that k and K both mean 1024, and G therefore means GiB.

All of the free space

The -l form accepts percentages. The manual explains that %FREE means the remaining free space in the volume group. One of its own examples takes all of it and handles the filesystem in the same step:

lvextend -l+100%FREE -r vg01/lvol01

Smaller fractions work the same way. -l +50%FREE takes half of what is left, which keeps room in reserve for another volume or for snapshots later. The manual adds a detail worth knowing: when the size is expressed as a percentage, it defines an upper limit for the number of extents, so the result is rounded to whole extents rather than hitting the exact fraction.

That -r is the flag that would have prevented the confused df at the top of this post.

The filesystem layer

Why df did not change

After lvextend alone, the logical volume is bigger, but the filesystem inside it still records its old size in its own metadata and only uses that much. The situation can be reproduced without LVM. A 64 MiB file was formatted with ext4, then enlarged to 128 MiB with truncate, which stands in for the LV growing:

$ truncate -s 64M disk.img
$ mkfs.ext4 -q -F disk.img
$ dumpe2fs -h disk.img | grep "Block count"
Block count:              16384
$ truncate -s 128M disk.img
$ dumpe2fs -h disk.img | grep "Block count"
Block count:              16384

The container doubled. The filesystem still has 16,384 blocks of 4 KiB, 64 MiB. This is exactly the state that makes df look wrong.

Growing ext4

The resize2fs manual says that if no size is given, it will default to the size of the partition, meaning the container it sits in:

$ resize2fs disk.img
resize2fs 1.47.0 (5-Feb-2023)
Resizing the filesystem on disk.img to 32768 (4k) blocks.
The filesystem on disk.img is now 32768 (4k) blocks long.

32,768 blocks of 4 KiB is 128 MiB, the full size. On a real system the target is the LV’s device path, for example resize2fs /dev/vg01/root. The page also says ext4 can be expanded while mounted, if the kernel supports it, so a root filesystem can grow without a reboot.

Growing XFS

XFS has its own tool, and it works the other way round: xfs_growfs takes the mount point, not the device, and its manual says plainly that the filesystem must be mounted to be grown.

xfs_growfs /

Running resize2fs on an XFS volume, or xfs_growfs on ext4, fails; lsblk -f or df -T shows which type is in use. The -r flag on lvextend avoids having to remember. It calls fsadm, whose manual says it tries to use the same API for ext2, ext3, ext4, ReiserFS and XFS, so one flag covers both common types.

Bookshelf

The complete sequence

New disk added

pvcreate /dev/sdb
vgextend vg01 /dev/sdb
lvextend -r -l+100%FREE vg01/root
df -h /

Existing virtual disk enlarged

# 1. grow the partition holding the PV (tool depends on the system)
pvresize /dev/sda3
lvextend -r -l+100%FREE vg01/root
df -h /

The last command in each is the check that matters. If df shows the new size, all the layers agree.

Shrinking is a different job

The order reverses, and mistakes lose data

Growing goes from the bottom of the stack to the top: disk, PV, VG, LV, filesystem. Shrinking has to go top down. The filesystem must be made smaller first, then the volume, and never the volume below the filesystem’s size.

The resize2fs page states the danger for partitions in so many words: when shrinking, make sure the partition is not made smaller than the new filesystem size. In the same test image, resize2fs disk.img 40M shrank the unmounted filesystem to 10,240 blocks without trouble, and resize2fs -P estimated the smallest possible size at 2,076 blocks. Doing those steps in the wrong order on a real volume, cutting the LV before the filesystem, removes the end of the filesystem along with whatever data sat there.

XFS adds a further limit. Its manual says only shrinking the last allocation group without removing it is implemented, which in practice means an XFS volume should be treated as grow-only. Shrinking one usually means backing up, recreating it smaller and restoring.

Sources

  • lvm(8), Linux manual page, man7.org: https://man7.org/linux/man-pages/man8/lvm.8.html
  • lvextend(8), Linux manual page, man7.org: https://man7.org/linux/man-pages/man8/lvextend.8.html
  • vgcreate(8), Linux manual page, man7.org: https://man7.org/linux/man-pages/man8/vgcreate.8.html
  • resize2fs(8), Linux manual page, man7.org: https://man7.org/linux/man-pages/man8/resize2fs.8.html
  • xfs_growfs(8), Linux manual page, man7.org: https://man7.org/linux/man-pages/man8/xfs_growfs.8.html
  • pvresize(8), Linux manual page, man7.org: https://man7.org/linux/man-pages/man8/pvresize.8.html
  • fsadm(8), Linux manual page, man7.org: https://man7.org/linux/man-pages/man8/fsadm.8.html

719 Posts

Peter Kalafatis writes and edits X9M8. He holds a bachelor's degree from LIU Post and a master's in Media Studies from The New School, with academic work in the philosophy of science, human behavior, AI, and memetics.

View All Posts

One Response to “Extending an LVM Logical Volume: The Three Layers, and Why df Still Shows the Old Size”

Leave a Reply

Your email address will not be published. Required fields are marked *