Thanks for the suggestions Eric,

great stuff and most appreciated.

I must play in my sandbox...

Paul O'Rorke
Tracker Software Products (Canada) Limited
www.tracker-software.com
Tel: +1 (250) 324 1621
Fax: +1 (250) 324 1623



Support:
http://www.tracker-software.com/support
Download latest Releases
http://www.tracker-software.com/downloads/




On 2018-05-01 02:31 PM, Eric Blake wrote:
On 05/01/2018 04:17 PM, Paul O'Rorke wrote:
I have been using internal snapshots on production qcow2 images for a couple of years, admittedly as infrequently as possible with one exception and that exception has had multiple snapshots taken and removed using virt-manager's GUI.

I was unaware of this:
There are some technical downsides to
internal snapshots IIUC, such as inability to free the space used by the
internal snapshot when it is deleted,

This is not an insurmountable difficulty, just one that no one has spent time coding up.


This might explain why this VM recently kept going into a paused state and I had to extend the volume to get it to stay up.  This VM is used for testing our software in SharePoint and we make heavy use of snapshots.  Is there nothing I can to do recover that space?

If you have no internal snapshots, you can do a 'qemu-img convert' to copy just the portion of the image that is actively in use; the copy will use less disk space than the original because it got rid of the now-unused space.  'virt-sparsify' from libguestfs takes this one step further, by also removing unused space within the guest filesystem itself.

In fact, even if you do have internal snapshots, there is probably a sequence of 'qemu-img convert' invocations that can ultimately convert all of your internal snapshots into an external chain of snapshots; but I don't have a ready formula off-hand to point to (experiment on an image you don't care about, before doing it on your production image).

What would be the best practice then for a VM that needs to be able to create and remove snapshots on a regular basis?

In a managed environment, external snapshots probably have the most support for creating and later merging portions of a chain of snapshots, although we could still improve libvirt to make this feel like more of a first class citizen.