Tasks (on a secondary disk, e.g. /dev/vdb)
- Create the PV, VG
vg_lab and a 1 GB LV lv_lab, formatted XFS. - Mount it on
/mnt/lab persistently (fstab). - Extend the LV to 3 GB and grow the filesystem without unmounting.
- 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