I'm trying to understand how qemu-img resize
shrinks the virtual disk. Let's say qemu-img info
shows that the virtual size is 20G, and the disk size is only 1G. Now I want to shrink the disk from 20G to a 5G. From the qemu-img documentation here: http://linux.die.net/man/1/qemu-img. It seems I should do it like this :
qemu-img resize filename -15G
But how can I make sure only the empty part of the disk will be shrunk, and my data will not be truncated?