Linux Labs

Storage / Stage 6 of 11

Logical volumes and growing a filesystem

Not running Starting usually ~20 s
Leave the lesson

Step 2 of 7 · on a machine · 7 min

Device, group, volume

Here LVM sits between the device and the filesystem. Its layers show up in the lsblk tree.

LVM is the logical volume manager. It pools the space of devices and hands out volumes of the size you need. While the pool has room, a volume can grow without touching its data.

The pool is called a volume group (VG); here it is lab_vg. Its space lives on the device /dev/loop0. The group has handed out the logical volumes (LV) data and keep. A logical volume is a block device, like a disk partition: you create a filesystem on it and mount that.

The lesson's chain looks like this: image file → loop0 → group lab_vg → volumes data and keep → ext4 on data → /mnt/lvm-data. lsblk draws it bottom-up: lab_vg-data and lab_vg-keep hang under loop0.

The volumes take 160M of 384M. The rest stays in the group and belongs to no volume. ext4 only knows its own volume, which is why df shows 100%.

vgs and lvs show the group and its volumes. They need sudo: without it they cannot reach the devices and LVM locks.

Exercise · look

Find the group's spare space

Look at the lab_vg group and its volumes with vgs and lvs and find how much space the group still has free. Change nothing.

Sign in and start The machine is available after signing in
Ubuntu 24.04
Loading…