[libvirt] libvirt internal snapshots incremental or not.

Eric Blake eblake at redhat.com
Mon Oct 13 14:28:59 UTC 2014


On 10/13/2014 04:39 AM, Sijo Jose wrote:
> Hi,
> Is libvirt internal snapshots are incremental or not..?
> Consider the example,
> There are 3 snapshots, created respectively snp1 first,
> after some changes snp2, again after some changes snp3.
> 
> Question,
> 1.Is there any dependency that is ...snp2 depended upon snp1 and snp3
> depended upon snp2 OR snp1 OR both
> 
> 2.So if I remove snp2, does it makes snp3 invalid, OR can I use snp3
> further.

The snapshots are independent.  Deleting one does not invalidate the other.

In more detail, internal snapshots are implemented by ref-counting in
the qcow2 file format.  Prior to a snapshot, all allocated clusters have
a ref-count of 1.  When you create a snapshot, all current clusters have
their ref-count incremented.  When you write to a cluster, if the
ref-count is larger than 1, it does a copy-on-write operation to put the
write in a new cluster (the COW part of qcow2), and decrements the
ref-count of the old cluster.  When reverting to a snapshot, you are
just changing which set of clusters is current.  When deleting a
snapshot, you decrement the ref-count of all clusters pointed to by the
snapshot, possibly freeing memory for clusters that drop to 0 ref-count.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 539 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20141013/0f30ba86/attachment-0001.sig>


More information about the libvir-list mailing list