Sub topic 9
Verifying the Result
This chapter assumes you can use the Linux command line with sudo, read df and lsblk output, and have just grown a logical volume (LV) and its filesystem as covered in earlier chapters. The goal here is to confirm that the new capacity is real at every layer, and that applications can use it.
Why verification is a separate step
A resize touches four layers: the disk or partition, the physical volume (PV), the volume group (VG) and logical volume (LV), and finally the filesystem. A command can succeed at one layer and leave the next layer unchanged. The most common example is an LV that grew while the filesystem inside it did not. In that case lvs shows the new size, but df still shows the old one, and the application still sees a full disk.
Verification means checking each layer from the bottom up and comparing it with the layer above. Every number should agree, allowing for small differences from metadata and rounding.
The layers and the commands that report on them:
| Layer | What it reports | Command |
|---|---|---|
| Block device or partition | Raw size the kernel sees | `lsblk`, `blockdev --getsize64` |
| Physical volume | Size of the PV and its free space | `pvs` |
| Volume group | Total size and `VFree` | `vgs` |
| Logical volume | Size of the LV | `lvs` |
| Filesystem | Usable size, used and available space | `df -hT`, `findmnt` |
| Application | Whether writes succeed | A test write, application logs |
Step 1: Compare the LV and the filesystem
The single most important check is whether the LV size and the filesystem size agree. Run these together:
sudo lvs -o lv_name,vg_name,lv_size,lv_path vg_data
df -hT /srv/data
lsblk -fSuppose the LV lv_app was 100 GiB and you added 20 GiB. A correct result looks like this:
LV VG LSize Path
lv_app vg_data 120.00g /dev/vg_data/lv_app
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/vg_data-lv_app xfs 120G 71G 49G 60% /srv/dataThe Size column in df is slightly smaller than the LV size in most cases. Filesystems reserve space for their own metadata (the journal, inode tables, and similar structures). A gap of a few percent on ext4 or under one percent on XFS is normal. A gap of the full 20 GiB means the filesystem step did not happen.
Note the device name. lvs reports /dev/vg_data/lv_app, while df reports /dev/mapper/vg_data-lv_app. Both names point to the same device-mapper device. If a hyphen appears in a VG or LV name, device-mapper doubles it in the /dev/mapper name (an LV called my-lv in VG vg becomes vg-my--lv).
Step 2: Read the units carefully
Two unit systems cause most of the "missing space" reports.
df -hand LVM use binary units: 1 GiB is 1024³ bytes. LVM printsgfor GiB.df -Huses decimal units: 1 GB is 1000³ bytes, so it prints larger-looking smaller numbers.
If a disk was sold as 500 GB, it holds 500,000,000,000 bytes, which is about 465.7 GiB. LVM will show about 465.66g. Nothing is missing. Use --units b on LVM commands or df -B1 when you need to compare exact byte counts.
sudo lvs --units b --nosuffix -o lv_name,lv_size vg_data
df -B1 --output=source,size,used,avail /srv/dataThe second command prints exact byte counts. The filesystem size will be a bit smaller than lv_size.
Step 3: Check the layers below the LV
If the LV did not grow as expected, the cause is usually lower in the stack. Check each layer.
lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS
sudo pvs -o pv_name,vg_name,pv_size,pv_free
sudo vgs -o vg_name,vg_size,vg_free,vg_free_countRead the output like this:
- If you added a new disk,
pvsshould list it with the VG namevg_data. A PV with an empty VG column was created withpvcreatebut never added withvgextend. - If you enlarged an existing disk,
lsblkshould show the larger size on both the disk and the partition. If the disk is larger but the partition is not,growpartwas not run or failed. If the partition is larger butpv_sizeis not,pvresizewas not run. vg_freeshows the space still unallocated. If you used-l +100%FREE, this should be at or near zero. If you used-L +20G, it should have dropped by 20 GiB.
A useful mental check is that the VG size equals the sum of its PV sizes, and the VG size equals the sum of all its LVs plus vg_free.
Step 4: Confirm the filesystem type and mount
The filesystem tool you used must match the filesystem type. df -T and findmnt confirm which one is in use.
findmnt -no SOURCE,FSTYPE,SIZE,USED,AVAIL,OPTIONS /srv/dataPay attention to the options column. If the mount shows ro, the filesystem is read-only. A read-only mount can appear after a kernel error on the underlying device, and it will block application writes even though the capacity is correct. Check dmesg or journalctl -k for storage errors before assuming the resize is at fault.
Looking at the filesystem's own metadata
For a direct view of what the filesystem believes its size is, ask the filesystem tool. These are read-only queries.
# ext4: block count and block size
sudo tune2fs -l /dev/vg_data/lv_app | grep -E 'Block count|Block size'
# XFS: data blocks and block size (takes the mount point)
sudo xfs_info /srv/data | grep -E 'data +='Multiply block count by block size to get the filesystem size in bytes. This should be close to the LV size. For XFS, the data line reports bsize and blocks. If blocks × bsize is much smaller than the LV, the filesystem has not been grown.
Step 5: Check inodes on ext4
Capacity has two limits on ext4: bytes and inodes. An inode is a record that describes one file. A volume with a large number of small files can run out of inodes before it runs out of bytes, and the error message is the same "No space left on device".
df -i /srv/dataGrowing an ext4 filesystem with resize2fs adds inodes in proportion to the new block groups, so the inode count rises along with the size. It will not change the inode density chosen when the filesystem was created. If IUse% is high after growing, the growth did not address the actual problem, and a new filesystem with a different inode ratio (mkfs.ext4 -i) would be needed.
XFS allocates inodes dynamically and is limited by a percentage setting (imaxpct), so inode exhaustion is rare there. Check it with xfs_info /srv/data if you suspect it.
Step 6: Test a write as the application would
Reported capacity does not prove the application can use it. Test a real write under the same user and path the application uses.
sudo -u appuser fallocate -l 1G /srv/data/.growth-test
ls -lh /srv/data/.growth-test
df -h /srv/data
sudo -u appuser rm /srv/data/.growth-test
df -h /srv/dataThe Used column should rise by about 1 GiB after the first df and fall again after the second. Replace appuser with the account that owns the service. If your filesystem is near full, choose a size that fits in the free space.
Then check the application itself. Some software reads free space once at startup. A database or a cache may keep a stale value and continue to refuse writes until it is restarted or told to rescan. Check the application's logs and its own storage status, not only the operating system's.
Step 7: Confirm the change will persist across reboots
LVM metadata is written to the PVs when you run each command, so the new LV size survives a reboot. The filesystem size is stored in the filesystem itself, so it also persists. Nothing in /etc/fstab stores a size. You can still verify that the mount entry is intact.
grep /srv/data /etc/fstab
sudo findmnt --verify
sudo vgs -o vg_name,vg_attrfindmnt --verify checks /etc/fstab for mistakes without mounting anything. In the vg_attr string, the fifth character should be z or -, not a flag that signals a problem. A VG that is marked partial (p in the fourth position) has a missing PV and needs attention before you rely on it.
A full reboot test is the strongest evidence, but it is not always acceptable on a production server. If you can schedule one, run the same checks from this chapter afterward.
Common problems and how to read them
| Symptom | Likely cause | What to check or do |
|---|---|---|
| `lvs` shows the new size, `df` shows the old size | The filesystem was not grown | Run `resize2fs` (ext4) or `xfs_growfs` (XFS), or use `lvextend -r` next time |
| `vgs` shows `VFree` unchanged after adding a disk | `pvcreate` ran but `vgextend` did not | Check `pvs` for an empty VG column, then run `vgextend` |
| Disk is larger in `lsblk`, PV is not | Partition was not grown, or `pvresize` was not run | Run `growpart`, then `pvresize` |
| Disk size in `lsblk` did not change | The hypervisor or cloud resize is not visible to the kernel | Rescan the device, or check the cloud console for a pending resize |
| `df` size is a little less than the LV | Filesystem metadata and reserved blocks | Normal. No action needed |
| `df` shows free space but writes fail with "No space left" | Inodes exhausted, quota, or a read-only mount | Check `df -i`, `findmnt` options, and quotas |
| `xfs_growfs` reports "not a mounted XFS filesystem" | Wrong argument, or the volume is not mounted | Pass the mount point, not the device, and mount it first |
| Application still reports a full disk | The application cached old values | Restart or reload the service |
What a clean result looks like
After a successful growth, all of these should hold:
pvsshows the PV sizes you expect, with the new or enlarged PV belonging to the right VG.vgsshowsVFreereduced by exactly the amount you allocated.lvsshows the new LV size.df -hTshows a filesystem size just under the LV size, with the same used space as before.- A test write succeeds, and the application runs without storage errors.
If the used space changed unexpectedly during the resize, stop and investigate. Growing a filesystem does not delete or move data. Used space should be the same, apart from normal activity by running services.
Keep a record of the before and after output. A simple approach is to capture it to a dated file.
{
date
sudo pvs; sudo vgs; sudo lvs
df -hT /srv/data
} | sudo tee /var/log/lvm-growth-$(date +%F).logThis gives you evidence of what changed, which helps if a later problem needs to be traced back to this work.
Exercise
After you run lvextend -L +20G /dev/vg_data/lv_app on a server with an ext4 filesystem mounted at /srv/data, lvs shows 120 GiB but df -h /srv/data still shows 100 GiB. Which command fixes this, and how do you confirm the fix worked?
Show answer
The LV was extended but the filesystem was not. Run sudo resize2fs /dev/vg_data/lv_app, which works while the filesystem is mounted. Confirm with df -hT /srv/data, where the size should now be just under 120 GiB, and check with df -i that the inode count rose. Using lvextend -r next time avoids the second step.
Exercise
A 500 GB disk was added to vg_data. vgs shows VSize of about 465.66g. Is space missing? Which command would give an exact comparison?
Show answer
No space is missing. The vendor counts 500 GB as 500,000,000,000 bytes, and LVM reports binary units, so 500 GB is about 465.66 GiB. Use sudo vgs --units b --nosuffix -o vg_name,vg_size to see exact bytes, and compare with 500,000,000,000 (a little less, because of LVM metadata).
Exercise
df -h shows 40 GB available on an ext4 volume, but an application reports "No space left on device". List three checks you would run.
Show answer
First, df -i /srv/data to see whether inodes are exhausted. Second, findmnt -no OPTIONS /srv/data to see whether the filesystem was remounted read-only, followed by journalctl -k for storage errors. Third, check for user or project quotas with quota or xfs_quota. You can also test a write as the application's user and check whether the application cached an old free-space value.