On Mon, Nov 29, 2021 at 13:05:40 +0100, Elias Mobery wrote:
Hi everybody!
I'm using a snapshot purely for writes and was wondering if it's possible
to clear/empty the snapshot after it reaches a certain size?
Created with:
virsh snapshot-create-as --disk-only
So this creates a so-called external snapshot, which for disks means an
overlay image.
I tried deleting and recreating it but get an error at deletion:
virsh snapshot-delete
but unfortunately deleting external snapshots is not yet implemented.
The usual approach is to do a block commit operation to merge the
overlay images back into the backing image manually.
The basic syntax via virsh is:
virsh blockcommit --active --pivot --verbose $VM $DISK
This merges any overlay images into the backing image. Backing image is
the most deepest nested image when you look at <backingStore> in the
XML.
Error: source for disk 'vda' is not a regular file
This error doesn't make much sense though. The error should state that
deletion of external snapshots is nto supported.
I also tried virsh snapshot-create-as --no-metadata --disk-only
This creates a snapshot without libvirt metadata. This means that
libvirt just creates the overlay, but doesn't create any internal state
related to it.
It saves you the step of deleting metadata, but you still need to
manually merge the image.
But the same error as above pops up when trying to delete.
This makes absolutely no sense though. Are you sure you are copying the
correct error message? 'virsh snapshot-delete' works _only_ with
snapshots which do have metadata, so if you create a snapshot without
there's nothing to delete.