Sub topic 9
Verifying the Result After Growing LVM Storage
This chapter assumes that you understand physical volumes (PVs), volume groups (VGs), logical volumes (LVs), mount points, and filesystems. It also assumes that you have already extended an LV or changed the storage underneath it. The goal here is to prove that the filesystem and applications can use the new capacity.
A successful lvextend command does not always mean the job is complete. The LV can be larger while the filesystem still has its old size. Verification should check every layer.
Check Each Storage Layer
LVM storage has several layers:
The checks answer different questions:
| Check | Question it answers |
|---|---|
| `lsblk -f` | Which devices, partitions, filesystems, and mount points exist? |
| `pvs` | How much space does each physical volume provide? |
| `vgs` | How much free space remains in each volume group? |
| `lvs` | How large is each logical volume? |
| `df -hT` | How much filesystem capacity is available to users? |
The logical volume size and filesystem size should normally agree closely. A small difference is expected because filesystems reserve space for metadata and may report capacity using different units.
Inspect the Devices and Mount Point
Start with a broad view of the block devices:
lsblk -fThe -f option displays filesystem information. Find the logical volume that backs the directory you changed. A typical result might show:
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
sda
├─sda1 ext4 1.0 1111-2222 800M 20% /boot
└─sda3 LVM2_member aaaa-bbbb
└─vg_data-lv_app xfs cccc-dddd 160G 8% /srv/dataThis output confirms that /dev/vg_data/lv_app is mounted at /srv/data. It also shows the filesystem type. That type determines which resize tool would have been needed.
Use findmnt when you need an exact relationship between a directory and its source device:
findmnt /srv/dataExample output:
TARGET SOURCE FSTYPE OPTIONS
/srv/data /dev/mapper/vg_data-lv_app xfs rw,relatimeThe source may appear as /dev/mapper/vg_data-lv_app instead of /dev/vg_data/lv_app. These are two names for the same device.
Compare the Logical Volume and Filesystem Sizes
Inspect the LVM layer:
sudo lvs -o lv_name,vg_name,lv_size,lv_attrThe lv_size column shows the size assigned to the logical volume. For a more complete view, include the physical volume and volume group information:
sudo pvs
sudo vgsAfter extending an LV by consuming free space, vgs should show less VFree. If you used all remaining free extents, VFree should be close to zero. If you added a new disk, the volume group may still have free space because you added more capacity than the LV consumed.
Now check the filesystem:
df -hT /srv/dataExample:
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/vg_data-lv_app xfs 200G 8.0G 192G 4% /srv/dataThe Size value is the capacity that applications can use. It is not enough for lvs to report 200G. df must also report the expected filesystem size.
If lvs reports 200G but df reports 100G, the logical volume was extended but the filesystem was not grown. Use the filesystem-specific command:
# For an ext4 filesystem:
sudo resize2fs /dev/vg_data/lv_app
# For an XFS filesystem:
sudo xfs_growfs /srv/dataXFS uses the mounted directory as its argument. Ext4 uses the logical-volume device path.
Test Capacity Without Filling the Disk
A capacity check should not write large amounts of data to production storage. Instead, confirm that the mount point is writable with a small temporary file:
sudo sh -c 'printf "LVM verification\n" > /srv/data/.lvm-verification'
sudo cat /srv/data/.lvm-verification
sudo rm /srv/data/.lvm-verificationThe first command writes a small file. The second reads it back. The final command removes it. If the directory is intentionally read-only, skip this test and check the mount options with findmnt.
You can also test the available space numerically:
df -P /srv/dataThe -P option requests a predictable, one-line-per-filesystem format that is easier for scripts to read. Do not compare values from df -h and lvs as exact numbers because human-readable units are rounded.
Common Verification Errors
Several mistakes can produce misleading results:
- Checking
/instead of the directory that was resized. Always pass the intended mount point todf. - Looking only at
lvs. This confirms LV capacity, not filesystem capacity. - Assuming a larger disk means a larger filesystem. The disk, PV, LV, and filesystem may each need a separate resize step.
- Reading the wrong device. Use
findmnt /srv/datato identify the device actually mounted there. - Confusing free VG space with free filesystem space.
VFreebelongs to LVM and is not available to files until an LV and filesystem use it. - Treating rounded values as exact. Compare the general capacity and use the tools' raw or consistent output when precision matters.
A Repeatable Verification Sequence
Run this sequence after a resize:
findmnt /srv/data
lsblk -f
sudo pvs
sudo vgs
sudo lvs -o lv_name,vg_name,lv_size,lv_attr
df -hT /srv/dataThe results should describe one consistent path:
findmntidentifies the mounted source.lsblk -fidentifies the filesystem type.pvsandvgsshow the physical and pooled capacity.lvsshows the logical volume capacity.dfshows the capacity available inside the filesystem.
If the first four checks agree but df remains unchanged, stop and grow the filesystem. If df shows the new size but an application still reports the old value, investigate application caching, quotas, container limits, or a different mount point.
Exercise
lvs reports that /dev/vg_data/lv_app is 200G, but df -hT /srv/data reports 100G. What does this show, and what command would grow the filesystem if lsblk -f identifies it as XFS?
Show answer
The logical volume was extended but the filesystem was not. Run sudo xfs_growfs /srv/data, then run df -hT /srv/data again.