I have a VM running Ubuntu. It used to have 30GB of space; I need to increase the size of the data partition, a LVM2 one, to 50GB.
I changed the size in the VM's management console and this is what fdisk -l
tells me:
Disk /dev/sda: 53.7 GB, 53687091200 bytes <--- new size
[...]
Device Boot Start End Blocks Id System
/dev/sda1 * 1 32 248832 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 32 6528 52177921 5 Extended <--- huh?!?
/dev/sda5 32 3917 31205376 8e Linux LVM <--- old size
[...]
I had read up plenty of stuff about LVM first, and ended up with this Serverfault question about resizing a LVM partition on the fly.
sda2
seems to be the container containing sda5
, which if I understand LVM correctly is the way things should be.
However, when I try
sudo lvextend /dev/DOCS/root -l+100%FREE
I get
New size (7118 extents) matches existing size (7118 extents)
I don't fully grasp the concept of LVM yet. Do I need to enlarge something else first, like the "outer container" of the partition?
This has come op before:
See this How to grow LVM and underlying partition? for a way to get the desired result without having to re-create the existing partition in fdisk.
You need to expand the partition (/dev/sda5) first. Go into fdisk, delete /dev/sda5, create a new extended partition (/dev/sda5 - it MUST be the same number as the old one), write the changes out and reboot. Then you can lvextend.
Be careful - doing this wrong will lead to data loss.