Skip to content

Internal Snapshot of qcow2 disk image

vrms edited this page Sep 18, 2016 · 7 revisions

make an internal snapshot

1.) shutdown the related VM

$ sudo virsh shutdown [my_domain]

2.) make and internal snapshot of the disk image (there are other types of snapshots as well)

$ cd /path/to/image_files
$ ls -l
$ sudo qemu-img snapshot -c sn1 [my_image].qcow2

3.) check on the snapshot

$ sudo qemu-img info [my_image].qcow or $ qemu-img snapshot -l [my_image}.qcow2

Note neither $ virsh domblklist [my_domain] nor $ virsh snapshot-list [my_domain] will show such a snapshot. Not clear yet, why that is so though.

4.) restart VM

$ sudo virsh start [my_domain]

revert to a previous snapshot

1.) shutdown the related VM

2.) list existing disk snapshots $ sudo qemu-img info [my_image].qcow or $ qemu-img snapshot -l [my_image}.qcow2

3.) revert to the state of a previous snapshot (sn1 in our example)

$ sudo qemu-img snapshot -a sn1 [my_image].qcow2 -a applies a snapshot (revert disk to saved state)

4.) restart VM

Clone this wiki locally