From 665eadc8d6207de579bfbba7a49871076e21b96c Mon Sep 17 00:00:00 2001 From: steffen Date: Wed, 4 Nov 2026 21:05:28 +0100 Subject: [PATCH] Grow cloud image root by 4 GB before customizing (Docker install filled the disk) --- install.sh | 6 +++++- lib.sh | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 1cdc1d9..718742c 100755 --- a/install.sh +++ b/install.sh @@ -267,10 +267,14 @@ print_summary() { build_template() { local id=$1 name=$2 cores=$3 ram=$4 disk=$5 docker=$6 local image="$WORKDIR/build-$id.img" - local -a customize=(--install qemu-guest-agent) + # The cloud image's root filesystem is only ~2 GB, too small for Docker. + # Grow the image by 4 GB and the root partition with it before installing. + local -a customize=(--run-command 'growpart /dev/sda 1 && resize2fs /dev/sda1' + --install qemu-guest-agent) info "[$id] Preparing image for $name" cp "$BASE_IMAGE" "$image" + qemu-img resize -q "$image" +4G if [[ $docker == y ]]; then customize+=(--run-command 'curl -fsSL https://get.docker.com | sh') diff --git a/lib.sh b/lib.sh index 0d6f179..b3ec129 100755 --- a/lib.sh +++ b/lib.sh @@ -29,6 +29,11 @@ build_template() { local disk="$work/disk.qcow2" cp "$IMAGE_DIR/$(basename "$IMAGE_URL")" "$disk" + # The cloud image's root filesystem is only ~2 GB, too small for Docker. + # Grow the image by 4 GB and the root partition (sda1) with it. + qemu-img resize -q "$disk" +4G + virt-customize -a "$disk" --run-command "growpart /dev/sda 1 && resize2fs /dev/sda1" + # Guest agent, extra packages, optional Docker, and an empty machine-id so clones get their own DHCP lease virt-customize -a "$disk" --install "qemu-guest-agent${PACKAGES:+,$PACKAGES}" if [ "${DOCKER:-0}" = 1 ]; then