Skip to content

Commit 6a6e7a3

Browse files
authored
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.
1 parent 4a7cdc0 commit 6a6e7a3

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

kvm-install-vm

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -634,18 +634,20 @@ _EOF_
634634
# Workaround to prevent virt-resize from renumbering partitions and breaking grub
635635
# See https://bugzilla.redhat.com/show_bug.cgi?id=1472039
636636
# Ubuntu will automatically grow the partition to the new size on its first boot
637-
if [[ "$DISTRO" = "ubuntu1804" ]] || [[ "$DISTRO" = "amazon2" ]]
638-
then
637+
case "$DISTRO" in
638+
ubuntu*|amazon2)
639639
qemu-img resize $DISK $DISK_SIZE &>> ${VMNAME}.log \
640640
&& ok \
641641
|| die "Could not resize disk."
642-
else
642+
;;
643+
*)
643644
qemu-img create -f qcow2 \
644645
-o preallocation=metadata $DISK.new $DISK_SIZE &>> ${VMNAME}.log \
645646
&& virt-resize --quiet --expand /dev/sda1 $DISK $DISK.new &>> ${VMNAME}.log \
646647
&& (mv $DISK.new $DISK && ok) \
647648
|| die "Could not resize disk."
648-
fi
649+
;;
650+
esac
649651
fi
650652

651653
# Create CD-ROM ISO with cloud-init config

0 commit comments

Comments
 (0)