On Tue, Mar 08, 2022 at 06:17:32 +0200, Jeff Brown wrote:
Apologies in advance if this be a stupid question, as everything
I've read
seems to suggest it's impossible.
Slowly running out of space on a 200GB root partition.
Is it possible to create a snapshot - leaving the QCOW2 image 'quiescent' -
resize it using 'qemu-img resize' - then pivot the snapshot back? (Then
shutdown, attach the storage to another bootable OS, and run fdisk and
resize2fs.)
Everything I've read says to shutdown the VM; but besides the real
possibility of the snapshot blockcommit being corrupted when pivoted into
the newly resized backing store, I don't see why it shouldn't work. And save
some significant downtime.
Please can someone advise if this is actually possible, or if I'm wasting my
time?
We actually also have 'virsh blockresize' which allows to modify the
size of the disk while the VM is running.
There are some caveats, e.g. certain disk bus and operating system
combinations will not notice that the size increased, but in most common
cases it actually works while the VM is running. The workaround if that
happens is to just reboot the guest.
The common approach is to:
virsh blockresize $VM $DISK $NEWSIZE (look into the manual for how size is treated)
in the vm then:
1) increase the size of the partition
2) resize LVM (physical volume) if used
3) resize filesystem using resize2fs or similar