Skip to content

Instantly share code, notes, and snippets.

@plembo
Last active November 5, 2023 18:28
Show Gist options
  • Save plembo/c8e6f43847b2e794316a8101b7c9969e to your computer and use it in GitHub Desktop.
Save plembo/c8e6f43847b2e794316a8101b7c9969e to your computer and use it in GitHub Desktop.
Resize a kvm boot partition

Resize a KVM (libvirtd) boot partition

Most of the guests I use for testing are desktop machines created using the graphical virt-manager tool. These have a single partition virtio disk that's formatted ext4 when Linux, without LVM. This is the procedure I follow to grow the disk when more space is needed:

  1. Shut down the guest.
  2. Use qemu-img to grow the disk:
$ sudo qemu-img resize myguest.qcow2 +20G
  1. Start the guest up again, login, open a terminal and install gparted.

  2. Run gparted and use to expand the primary partition into the newly expanded space.

It wasn't long ago that it would have been impossible to expand a boot partition while mounted as the boot partition for the system you were running the paritioning tool from. But now it is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment