On Wed, May 31, 2017 at 06:54:33PM +0300, Pavel Butsykin wrote: > It is assumed that the user has already made a preparatory with the > image: > 1. freeing space at the end of the image > 2. reducing the last partition on the disk > 3. rebuilding fs > Only after these steps, the user can reduce the image by qemu-img.
It's tricky with GPT, as GPT puts a second copy of the header in the last few sectors of the disk. I always advise people to use trim (or virt-sparsify) instead of trying to adjust virtual disk size. Nevertheless I don't think we should prevent shrinking qcow2 virtual size. It's likely useful to someone. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v