LVM and volume resizing
Quick answer
LVM separates logical storage from physical devices. You can allocate space from a volume group without assigning each filesystem a fixed disk partition.
Prepare the practice environment
Run python3 lab-fixtures/backup/setup.py from the extracted root as an ordinary user. Enter the printed fresh private path and check pwd. Use fresh fixtures, Bash with set -e -o pipefail, LC_ALL=C and umask 077. Only disposable regular files may be written. Optional examples require an authorized snapshot VM. Never substitute real devices, mount remote shares or change storage configuration. Review the lab guide.
How it works
A physical volume (PV) supplies extents to a volume group (VG); a logical volume (LV) consumes extents and presents a block device. A filesystem lives above the LV. Inspect PV, VG and LV reports before planning a change. Growing an LV alone does not necessarily grow its filesystem. ext4 can grow online in supported setups and shrink offline; XFS supports growth but ordinary XFS shrink is not supported. Confirm filesystem-specific procedures and free extents. Shrinking a block device first can destroy data. In our fictional report, a 100 GiB VG contains a 60 GiB LV and 40 GiB free; this is a simple thick-provisioned model, not thin-pool accounting.
In the fictional thick-provisioned volume group, allocating another 10 GiB to the LV would leave 30 GiB free before any rounding to extent boundaries. The filesystem could still report its old size until a supported filesystem growth operation succeeds. Verify the LV size and filesystem size separately. This arithmetic is planning only; it does not demonstrate a real resize, and it does not apply directly to thin provisioning.
Try the examples
Subtract allocated space from total in this simplified report.
Expected stdout:
labvg 40 GiB freeawk 'NR==2 {need=25; print (need <= $2-$3 ? "fits" : "insufficient")}' vg.txtThe 25 GiB request fits the model; actual extent rounding and allocation policies must still be checked.
Expected stdout:
fitsVM-only read-only inspection; compare device and volume identities before planning growth.
Manual example; not executed locally. Follow its stated environment restrictions.
Common mistakes
Never shrink an LV before the filesystem. Do not copy resize commands from another machine; verify the target, backup, filesystem and rollback plan.
Practice
Use vg.txt to decide whether 45 GiB of growth fits. Explain which layer must grow next and why a backup is still needed. Expected: insufficient; filesystem growth must be planned separately.
Related references
Study: pvs, vgs, lvs. These are reference names, not deployed links.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
LVM and volume resizing — Knowledge Check
Apply advanced storage and backup concepts to synthetic fixtures and VM-only scenarios.
Which layer pools extents?
Does LV growth always grow its filesystem?
How much free capacity is modeled in a 100 GiB VG with 60 GiB allocated?
What is unsafe before a shrink?