How-to extend a root LVM partition online
This guide will explain you how to extend a root LVM partition online.
There is also a quick remedy for the emergency situation when your root partition runs out of disk space. There is a feature specific to ext3 and ext4 that can help the goal of resolving the full disk situation. Unless explicitly changed during filesystem creation, both by default reserve five percent (5%) of a volume capacity to the superuser (root).
It turned out 111513 of 4KB blocks were reserved for the superuser, which was exactly five percent of the volume capacity.
How to enable it?
Now that we have some free space on the root partition to work on we can extend the LVM partition:
Create a new partition of appropriate size using fdisk
This is a key sequence on the keyboard to create a new LVM type (8e) partition:
n, p, 1, enter (accept default first sector), enter (accept default last sector), t, 8e, w
Create a new Physical Volume
Extend a Volume Group
Extend your LVM
- extend the size of your LVM by the amount of free space on PV
- or with a given size
Finally resize the file system online
Now we can set the reserved blocks back to the default percentage - 5%
Results: