Jan 8
2021
resize img size for QEMU / KVM
STOP VM !
Add +5G do disk
qemu-img resize chr-7.2.img +5G
Change disk size to 20G
qemu-img resize chr-7.2.img 20G
This example will convert a raw image file named image.img to a qcow2 image file.
qemu-img convert -f raw -O qcow2 image.img image.qcow2
Rescan resized partition
partprobe /dev/vdb
or
growpart /dev/vdb 1
Resize partition
resize2fs /dev/vdb1
Useful commands
virsh destroy vm_name virsh list virsh edit vm_name
Set CPU resources
virsh vcpucount <vm_name>
virsh setvcpus <vm_name> <max-number-of-CPUs> --maximum --config
virsh setvcpus <vm_name> <number-of-CPUs> --config
virsh setvcpus <vm_name> <number-of-CPUs> --live