![qemu img resize qemu img resize](https://documentation.suse.com/sles/15-SP1/html/SLES-all/images/qemu_guest_partman.png)
NOTE: This link was useful for METHOD #1, and shows how to accomplish increasing a KVM's disk space (ext3 based), HOWTO: Resize a KVM Virtual Machine Image. I'm asking how to accomplish this while the KVM is offline. The 1st asks the question of how to increase a KVM guest while it's online, while the 2nd is XEN specific using LVM. These serverfault questions are similar but more specific, KVM online disk resize? & Centos Xen resizing DomU partition and volume group.
![qemu img resize qemu img resize](https://computingforgeeks.com/wp-content/uploads/2019/04/extend-kvm-disk-image.png)
At this point, go ahead and resize your partitions and LVM structure as needed. Running dmesg should report that the virtio disk detected a capacity change. Signal the virtio driver to detect the new size (specify the total new capacity): virsh qemu-monitor-command block_resize drive-virtio-disk0 20G -hmp Get the name of the virtio device, via the libvirt shell ( drive-virtio-disk0 in this example): virsh qemu-monitor-command info block -hmpĭrive-virtio-disk0: removable=0 io-status=ok file=/var/lib/libvirt/images/.img ro=0 drv=raw encrypted=0ĭrive-ide0-1-0: removable=1 locked=0 tray-open=0 io-status=ok Increase the size of the disk image file itself (specify the amount to increase): qemu-img resize. Perform the following from the KVM hypervisor. To remove that risk, you would need to log into the VM and unmount the target disk first, something that isn't always possible. This can be useful in environments where the disk cannot be unmounted (such as a root partition), the VM must stay on, and the system owner is willing to assume the risk of data corruption. Online Method (using qemu, libvirt, and virtio-block)įor better or worse, the commands below will run even if the target virtual disk is mounted.