On 08/21/2014 07:37 AM, Adam King wrote:
> Your quoting is horrible. You used the same prefix for your original
> content as for my reply (">> >" in both cases). I'm not sure
what
> mailer you are using, but it is making conversation difficult.
OK, let's see if this is better. Turned out my email app wasn't doing text wrap
and quoting prefix default was bizarre....my apologies.
Better. Still have the long lines issue, but at least the quoting worked :)
> Also, be aware that snapshot deletion does NOT shrink the listed
disk
> size of a file, although with newer qemu, it DOES punch holes so that
> the amount of disk space actually occupied by the file is smaller. Or
> put another way, qemu-img (which is all the more libvirt
> snapshot-delete
> is using) does not know how to compact an image after deleting
> snapshots
> (no one has yet written a qcow2 defragmenter, although such a thing
> should be technically doable). In your situation, I'd highly
> recommend
> looking into virt-sparsify from libguestfs - that's a program that is
> designed to copy (or even attempt in-place) disk images so that the
> copy
> doesn't need as large of a file size.
>
That certainly does sound useful. I have found
http://serverfault.com/questions/329287/free-up-not-used-space-on-a-qcow2...
which, frankly, seems like a hack.
that page requires offline modification (and so does virt-sparsify).
But there IS a potential solution that can be done without taking the
guest offline: live storage migration with 'virsh blockcopy':
If APP01 is currently using (bloated) disk1.img, it is possible to do a
sequence of commands that still keeps APP01 running the whole time but
switches APP01 over to using a (brand-new, and therefore unbloated)
disk2.img with no impact to the guest contents. Right now, it's still
necessary to go through a transient domain (which highlights the risk
that qemu doesn't make the command restartable, so you don't want the
guest to go down during the window of the operation):
virsh domblklist APP01 # learn what strings you can use for $disk below
virsh dumpxml APP01 > tmp.xml # save the domain, to re-define it later
virsh undefine APP01 # go transient, to allow blockcopy
virsh blockcopy APP01 $disk /path/to/disk2.img --verbose --wait --pivot
$EDITOR tmp.xml # change disk1.img to disk2.img
virsh define tmp.xml # back to normal
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org