The group hands out space in equal pieces. They decide how much of the pool a volume's growth uses.
A device given to the group is a physical volume (PV), here /dev/loop0. LVM cuts it into extents, pieces of one size, 4 MiB each in the training group. A volume gets a whole number of extents: the 128 MiB data volume is 32 extents, and growing it to 256 MiB takes 32 more.
lvextend grows a volume. The -L size comes in two forms:
| Form | Result for a 128 MiB volume |
|---|---|
-L 256M: the final size |
256 MiB |
-L +256M: add to the current size |
384 MiB |
The final size is the safer form. Repeating the same command changes nothing: lvextend prints New size (64 extents) matches existing size. Repeating +256M adds the same amount again. M in LVM sizes means mebibytes.
You do not have to give one volume the whole pool: a neighbouring volume or a snapshot may need it, and snapshots are the next lesson. If the pool is too small, lvextend fails with Insufficient free space.
The data volume is 128 MiB, and the group has 220 MiB free. You ran sudo lvextend -L 192M /dev/lab_vg/data twice in a row. What will sudo lvs show?
-
Without a plus,
-Lsets the final size. On the second runlvextendprintsNew size (48 extents) matches existing size: the volume is already that size. -
Adding takes
-L +96M, with a plus.-L 192Mbrings the volume to 192 MiB and leaves it alone on a repeat. -
Taking everything needs
-l +100%FREE.-L 192Mtakes exactly the extents needed to reach 192 MiB: 16.
-L without a plus sets the final size: the first run added 16 extents, and the second reported the size unchanged. Check the result with sudo lvs lab_vg.
Key points
- The group hands space to volumes in extents, 4 MiB each in the training group.
-
-L 256Msets the final size, so a repeat is safe;-L +256Madds on every run.