Problem:
When we provision Ubuntu 20.04 and Ubuntu 22.04 Hosts, the LV partition size for / is only 50% of what is in the volume group.
Does anyone happen to know how to extend this to 100%? I know this is more of an Ubuntu question, but figured this would be a better spot to ask. I’ve tried adding the setting: sizing-policy: all, from here: Automated Server installer config file reference | Ubuntu but still no luck.
Expected outcome:
Ubuntu Servers are provisioned from Foreman using autoinstall user-data and the / partition is utilizing 100% of the local disk space.
If there is free space in the volume group (vgdisplay) then you can
extend a logical volume using the lvextend command (for example lvextend
-L +1G /dev/vg/lv where vg=the volume group name and lv = the logical
volume name, the “-L +1G” will extend the lv by 1GB). Once the lv is
extended use resize2fs (for ext4 filesystems) or xfs.growfs (for xfs
filesystems) to pick up the extended space.
If there is free space available on the actual disk drive you can use
fdisk to create a new partition containing all the remaining disk space
and then add that to the volume group (vgextend).
You can expand the partition / slice on the disk using fdisk by deleting
the current partition / slice (for example sda2) and recreating it again
using the exact number listed under that “start” heading (for example
/dev/sda2 2099200 146800639 144701440 69G 8e Linux LVM, you would
use 2099200) and when prompted for the end value just hit enter to pick
up the remaining space. This method is slightly more risky so if you are
unsure try the first method instead.
Yes. The additional 50% of free space shows up when I run a “vgdisplay”. I know that I can just do an lvextend -l 100%Free and resize2fs after the OS is installed. Right now I just have a cloud-init per instance script doing this to help automate it. Although I thought there would be a better way of defining this in the autoinstall user-data storage section. Figured someone here would have known.