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 <abologna@redhat.com>
This commit is contained in:
Andrea Bolognani
2025-01-24 16:23:26 +01:00
parent 9fed79138a
commit d33836e560
+12
View File
@@ -43,6 +43,18 @@ if [[ "$kiwi_profiles" != *"Container"* ]] && [[ "$kiwi_profiles" != *"FEX"* ]];
echo "GRUB_DISABLE_RECOVERY=true" >> /etc/default/grub echo "GRUB_DISABLE_RECOVERY=true" >> /etc/default/grub
fi 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 # Delete & lock the root user password
#-------------------------------------- #--------------------------------------