RHCSAv10 · RHEL 10

Exercises

Exercise: full LVM workflow

updated 2026-10-19 by seed

Tasks (on a secondary disk, e.g. /dev/vdb)

  1. Create the PV, VG vg_lab and a 1 GB LV lv_lab, formatted XFS.
  2. Mount it on /mnt/lab persistently (fstab).
  3. Extend the LV to 3 GB and grow the filesystem without unmounting.
  4. Check that mount -a produces no error.

Verify

vgs vg_lab ; lvs /dev/vg_lab/lv_lab
df -h /mnt/lab                  # 3.0G
findmnt /mnt/lab -o SOURCE,FSTYPE,SIZE
mount -a && echo fstab-ok

Solution

sudo pvcreate /dev/vdb
sudo vgcreate vg_lab /dev/vdb
sudo lvcreate -L 1G -n lv_lab vg_lab
sudo mkfs.xfs /dev/vg_lab/lv_lab
sudo mkdir -p /mnt/lab
echo '/dev/vg_lab/lv_lab /mnt/lab xfs defaults 0 0' | sudo tee -a /etc/fstab
sudo mount -a
sudo lvextend -L 3G /dev/vg_lab/lv_lab
sudo xfs_growfs /mnt/lab