From 6a6e7a32b6483b89564a66cbe6533abc5471a092 Mon Sep 17 00:00:00 2001 From: Michael Meffie Date: Sat, 13 Jun 2020 14:44:32 -0400 Subject: [PATCH] Fix ubuntu2004 disk resize (#62) Use the `qemu-img resize` command to resize ubuntu 20.04, as is done for ubuntu 18.04 This fixes the error on boot: Booting form Hard Disk... error: unknown filesystem. Entering resue mode... grub rescue> Also use `qemu-img resize` on ubuntu 16.04, so all versions of ubuntu use this method. --- kvm-install-vm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/kvm-install-vm b/kvm-install-vm index f41a2fe..5cbf786 100755 --- a/kvm-install-vm +++ b/kvm-install-vm @@ -634,18 +634,20 @@ _EOF_ # Workaround to prevent virt-resize from renumbering partitions and breaking grub # See https://bugzilla.redhat.com/show_bug.cgi?id=1472039 # Ubuntu will automatically grow the partition to the new size on its first boot - if [[ "$DISTRO" = "ubuntu1804" ]] || [[ "$DISTRO" = "amazon2" ]] - then + case "$DISTRO" in + ubuntu*|amazon2) qemu-img resize $DISK $DISK_SIZE &>> ${VMNAME}.log \ && ok \ || die "Could not resize disk." - else + ;; + *) qemu-img create -f qcow2 \ -o preallocation=metadata $DISK.new $DISK_SIZE &>> ${VMNAME}.log \ && virt-resize --quiet --expand /dev/sda1 $DISK $DISK.new &>> ${VMNAME}.log \ && (mv $DISK.new $DISK && ok) \ || die "Could not resize disk." - fi + ;; + esac fi # Create CD-ROM ISO with cloud-init config