How to expand boot partition in front of LVM partition
I have a Ubuntu server where my boot partition needs to be expanded:
The server is virtual and running on VMWare. I have booted from the GParted LIVE CD (version 0.27.0) but GParted doesn't let me resize the partitions.
If I understand correctly I need to move some of the 4GB unallocated space (equal to the size I would like to expand the boot partition with) so it is located just right of the boot partition.
The yellow locks in the image appearently means that the partition /dev/sda5
is mounted, but I don't understand by who and why - since I'm booting from a LIVE CD.
Calling sudo umount /dev/sda2
or sudo umount /dev/sda5
just tells me that they aren't mounted:
GParted allows me to click deactivate on /dev/sda5
but it doesn't change anything:
In the end I would like to expand /dev/sda5
to take up the remaining unallocated space, but the first step is to expand the boot partition.
How can I expand the boot partition?
I faced the exact same problem, came across this post, and solved it. I did the following with a 16.04.3 live CD:
Used KDE Partition Manager to expand
/dev/sda2
to the end of the driveUsed KDE Partition Manager to move
/dev/sda5
to the end of the driveTried to use KDE Partition Manager to squeeze out the empty space on the left side of
/dev/sda2
, but failed. It wanted to first move/dev/sda2
to the right and then chop off an equal amount of space from the right side of/dev/sda2
but there was no room on the drive to do so.Used gparted to squeeze out the empty space on the left side of
/dev/sda2
.Used gparted to grow
/dev/sda1
and occupy the whole space.
It worked without updating grub.
Notes:
/dev/sda5
is encapsulated by/dev/sda2
so you can't move or expand/dev/sda5
without making changes on/dev/sda2
first.You may try to move
/dev/sda2
directly to the right. I should have tried it before expanding/dev/sda2
.I used KDE Partition Manager first because I was convinced that gparted doesn't support LV, but now I doubt it because I can activate/deactivate LV with gparted, and I will try gparted for the same operations if I have the chance in the future.
Update:
I recreated the scenario in a virtual machine and tried gparted from 16.04.3 live CD. Now I can confirm that the whole procedure can be done solely by gparted, but I can't move /dev/sda2
directly to the right.
GParted does not support resizing LVM logical volumes. It doesn't even see them. Only resizing of LVM PVs is supported. KDE Partition Manager 3.0 can resize them.
You can try Neon Live CD (https://neon.kde.org/download).
Install KDE Partition Manager using sudo apt install partitionmanager
KDE Partition Manager can resize LVM PVs that are members of LVM VG.
Here is a short video demonstrating how LVM resize capabilities : https://www.youtube.com/watch?v=FKCQ7pJN1vY