- Shut down the virtual machine
- Resize the image with
qemu-img resize image.qcow2 +SIZE
SIZEis the size (e.g.
10Gfor 10 gigabytes).
- Boot into gparted live and resize the partition.
- Boot into gparted live and resize the partition smaller.
- If you managed to resize the partition from within the virtual machine (and thus didn’t shut it down already for resizing), shut it down now.
- KVM/QEMU images are stored in
/var/lib/libvirt/imagesby default. I store them under
/storage/imagesfor my purposes. This process is done by root-only, so
suis acceptable in this case. Create a new smaller qcow2 file to store the copied data
qemu-img create -f qcow2 -o preallocation=metadata newimage.qcow2 NEW_SIZE
NEW_SIZEis the size (
10Gfor the exampl...