Libvirt Snapshot Question

Elias Mobery eliasmobery at gmail.com
Tue Nov 30 13:51:54 UTC 2021


Hello Peter, thank you so much for that detailed info!

Sorry, you were right, when trying to delete my external snapshot via
snapshot-delete, the error says "deletion of external snapshots unsupported"

I can't merge the snapshot because the VM image is in a read-only
filesystem. Sorry I should've said, it's a live system. So the image is in
the read-only squashfs and external snapshot in overlay is used for writing.

Now I would like the snapshot emptied or deleted/recreated when it reaches
4GB.

Is there even a way to do this with the image being read-only?

Thanks again for your advice, I really love this community.


On Tue, Nov 30, 2021, 9:42 AM Peter Krempa <pkrempa at redhat.com> wrote:

> 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.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20211130/c89a0774/attachment.htm>


More information about the libvirt-users mailing list