From d33836e5605d348810f0df4aa0729f736c64ba68 Mon Sep 17 00:00:00 2001 From: Andrea Bolognani Date: Fri, 24 Jan 2025 14:12:12 +0100 Subject: config: Resize root partition on first boot Disk images are usually flashed to media which is much larger than they are, and all that additional space goes unused until the user intervenes. Configure things so that systemd-repart, which runs by default, automatically takes care of resizing the root partition. systemd-growfs, which also runs by default, will subsequently take care of resizing the filesystem to fill the newly-enlarged partition. Note that we don't do this for cloud images, since in that case cloud-init takes care of resizing the root filesystem and the underlying partition together with all the other setup tasks. Signed-off-by: Andrea Bolognani --- config.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/config.sh b/config.sh index 74ce9f6..fb10431 100755 --- a/config.sh +++ b/config.sh @@ -43,6 +43,18 @@ if [[ "$kiwi_profiles" != *"Container"* ]] && [[ "$kiwi_profiles" != *"FEX"* ]]; echo "GRUB_DISABLE_RECOVERY=true" >> /etc/default/grub fi +#====================================== +# Resize root partition on first boot +#-------------------------------------- + +if [[ "$kiwi_profiles" == *"Disk"* ]]; then + mkdir -p /etc/repart.d/ + cat > /etc/repart.d/50-root.conf << EOF +[Partition] +Type=root +EOF +fi + #====================================== # Delete & lock the root user password #-------------------------------------- -- cgit v1.3.1+13