[libvirt-users] Snapshots: Where they are stored and how to use them?

Eric Blake eblake at redhat.com
Wed Oct 2 17:27:26 UTC 2013


On 10/02/2013 09:56 AM, Roland Giesler wrote:
> Firstly I'd like to learn where a snapshot is stored once it has been
> made.

That depends - did you create an external or an internal snapshot?
'virsh snapshot-info Windows Windows' will help.

>  I understand that the principle is that when changes occur in
> the VM, the difference is written to the snapshot, thus recording the
> differences between the date/time of the snapshot and the current
> value of the VM.  Is that a correct assessment of the process?

Sort of.  The differences aren't recorded in the snapshot, so much as it
records the contents at the point in time it was taken, and running the
VM now tracks the differences compared to when the snapshot was taken.
That is, the snapshot is not being modified, but the current state.

> 
> If that is indeed so, can I take regular snapshots and back then up
> onto external storage to provide a sort of system restore point at
> certain times in the past?

Yes, that is one use for snapshots (done better with external snapshots,
because qemu 1.6 lacks the ability to let you view the contents of
internal snapshots while the domain is running - patches have been
proposed for qemu 1.7 to start addressing that, but then libvirt would
also have to be taught to take advantage of the new qemu feature).  But
be aware that external snapshots are still not fully implemented in
libvirt - while you can create them, we do not yet have decent support
in place for libvirt-only revert or delete of a snapshot.  See this wiki
page for more than you ever wanted to know about management of external
snapshots (and update it, if you'd like):

http://wiki.libvirt.org/page/I_created_an_external_snapshot%2C_but_libvirt_won%27t_let_me_delete_or_revert_to_it

> 
> I have scanned the server hard disks for the snapshot images after
> running "sudo virsh snapshot-create Windows /etc/libvirt/snapshot.xml"
> and the system reports a snapshot was taken, yet I cannot find any
> file that contains the snapshot.
> 
> $ sudo virsh snapshot-list Windows
>  Name                 Creation Time             State
> ------------------------------------------------------------
>  Windows              2013-10-02 12:41:06 +0200 running

Then you probably took an internal snapshot, which means that the very
qcow2 file that is hosting the disk image is also holding the snapshot.
 'qemu-img info /path/to/qcow2' would confirm this.

> 
> What will happen to the snapshot if the host server is restarted?

It will still be there, ready for you if you ever want to revert to it.

-- 
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: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20131002/53b33d3c/attachment.sig>


More information about the libvirt-users mailing list