How to resize a Windows VM image with virt-resize qcow2

Notes

apt install libguestfs-tools virt-manager gnome-boxes

Check for snapshots and delete them:

qemu-img info win10.qcow2
qemu-img snapshot -l win10.qcow2
qemu-img snapshot -d 4  win10.qcow2

 Resize:

qemu-img info win10.qcow2
qemu-img resize win10.qcow2 +23G

List partitions, select partition to get the new size, resize that partition

sudo virt-filesystems -hl -a win10.qcow2
Name       Type        VFS   Label            Size  Parent
/dev/sda1  filesystem  ntfs  System Reserved  500M  -
/dev/sda2  filesystem  ntfs  -                39G   -
/dev/sda3  filesystem  ntfs  -                843M  -

qemu-img create -f qcow2 win10_63G.qcow2 63G
sudo virt-resize --expand /dev/sda2 win10.qcow2  win10_63G.qcow2


References:

https://mike42.me/blog/how-to-resize-a-windows-vm-image-with-virt-resize

Comments