<div dir="auto">Hello Peter, thank you so much for that detailed info!<div dir="auto"><br></div><div dir="auto">Sorry, you were right, when trying to delete my external snapshot via snapshot-delete, the error says "deletion of external snapshots unsupported"</div><div dir="auto"><br></div><div dir="auto">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.</div><div dir="auto"><br></div><div dir="auto">Now I would like the snapshot emptied or deleted/recreated when it reaches 4GB.</div><div dir="auto"><br></div><div dir="auto">Is there even a way to do this with the image being read-only?</div><div dir="auto"><br></div><div dir="auto">Thanks again for your advice, I really love this community.</div><br><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">On Tue, Nov 30, 2021, 9:42 AM Peter Krempa <<a href="mailto:pkrempa@redhat.com">pkrempa@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Mon, Nov 29, 2021 at 13:05:40 +0100, Elias Mobery wrote:<br>
> Hi everybody!<br>
> <br>
> I'm using a snapshot purely for writes and was wondering if it's possible<br>
> to clear/empty the snapshot after it reaches a certain size?<br>
> <br>
> Created with:<br>
>  virsh snapshot-create-as  --disk-only<br>
<br>
So this creates a so-called external snapshot, which for disks means an<br>
overlay image.<br>
<br>
> <br>
> I tried deleting and recreating it but get an error at deletion:<br>
> <br>
> virsh snapshot-delete<br>
<br>
but unfortunately deleting external snapshots is not yet implemented.<br>
<br>
The usual approach is to do a block commit operation to merge the<br>
overlay images back into the backing image manually.<br>
<br>
The basic syntax via virsh is:<br>
<br>
  virsh blockcommit --active --pivot --verbose $VM $DISK<br>
<br>
This merges any overlay images into the backing image. Backing image is<br>
the most deepest nested image when you look at <backingStore> in the<br>
XML.<br>
<br>
> Error: source for disk 'vda' is not a regular file<br>
<br>
This error doesn't make much sense though. The error should state that<br>
deletion of external snapshots is nto supported. <br>
<br>
> <br>
> I also tried virsh snapshot-create-as --no-metadata --disk-only<br>
<br>
This creates a snapshot without libvirt metadata. This means that<br>
libvirt just creates the overlay, but doesn't create any internal state<br>
related to it.<br>
<br>
It saves you the step of deleting metadata, but you still need to<br>
manually merge the image.<br>
<br>
> <br>
> But the same error as above pops up when trying to delete.<br>
<br>
This makes absolutely no sense though. Are you sure you are copying the<br>
correct error message? 'virsh snapshot-delete' works _only_ with<br>
snapshots which do have metadata, so if you create a snapshot without<br>
there's nothing to delete.<br>
<br>
</blockquote></div></div>