Growing in two steps can stop halfway. Here is how to tell where it stopped and what to do next.
A volume grows only from the group's free extents, shown in the VFree column of vgs. When there are none, you add a physical volume to the group with vgextend. Check the disk first: it must be empty and meant for LVM, because preparing it for LVM wipes its partition table.
The group's VFree is 0, and the data volume needs another 100 MiB. What do you do?
-
mkfscreates an empty filesystem on the same volume: the data is lost, and there is no more room. -
A volume with a filesystem is shrunk only after the filesystem is, or the neighbour's data suffers. That is separate work with its own checks;
vgsandlvsdo not replace them. -
+100%FREEtakes the group's free extents, and there are none:lvextendprintsInsufficient free space.
A volume gets space only from the group's free extents. When there are none, you add a physical volume to the group, a checked empty disk (vgextend), and only then grow the volume.
Without -r, or after an error in the second step, the volume has grown and ext4 has not. Two commands side by side show it: sudo lvs shows the new volume size, and df -h the old filesystem size. What is left is to grow the filesystem: resize2fs with no size stretches it over the whole volume.
lvextend with a plus would grow the volume once more at this point, leaving the filesystem as it was. Shrinking the volume back as an undo is dangerous: cutting off blocks where ext4 keeps data damages the filesystem. mkfs does not help here either: it creates a new, empty filesystem in place of the old one.
Finish the growth
A colleague grew the /dev/lab_vg/data volume to 256 MiB, yet the service still cannot write to /mnt/lvm-data. Finish the growth without changing the volume's size, and as your own user write the line report to /mnt/lvm-data/report.txt.
Goals · 0 of 2
- Grow the filesystem to the volume's size not done yet
- Write report.txt as your own user not done yet