Skip to content

Commit

Permalink
Fix ubuntu2004 disk resize (#62)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
meffie authored Jun 13, 2020
1 parent 4a7cdc0 commit 6a6e7a3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions kvm-install-vm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6a6e7a3

Please sign in to comment.