{"id":833,"date":"2015-02-04T09:33:36","date_gmt":"2015-02-04T17:33:36","guid":{"rendered":"http:\/\/blog.ls-al.com\/?p=833"},"modified":"2015-02-04T09:33:36","modified_gmt":"2015-02-04T17:33:36","slug":"libvirt-and-qcow2-snapshots","status":"publish","type":"post","link":"https:\/\/blog.ls-al.com\/libvirt-and-qcow2-snapshots\/","title":{"rendered":"Libvirt and QCow2 Snapshots"},"content":{"rendered":"
This article is for one specific use case I had. \u00a0There is a lot more written around snapshots, qemu and libvirt. \u00a0For my use case a qcow2 formatted image and KVM virtual machine. \u00a0I wanted a way to capture machine state before an OS upgrade. \u00a0So that I can roll back or revert in case something goes wrong. \u00a0So for my case I do not care about live snapshots. \u00a0I can shut the machine down before taking a consistent snapshot of the image.<\/p>\n
Specifically I am using what is called an internal qcow2 snapshot.<\/p>\n
https:\/\/libvirt.org\/formatsnapshot.html<\/p>\n
\r\n# virsh snapshot-create-as debian1 pre-update\r\nDomain snapshot pre-update created\r\n# virsh snapshot-list debian1\r\n Name Creation Time State\r\n------------------------------------------------------------\r\n pre-update 2015-02-04 09:22:18 -0600 shutoff\r\n\r\n# virsh snapshot-current debian1\r\n<domainsnapshot>\r\n <name>pre-update<\/name>\r\n <state>shutoff<\/state>\r\n <creationTime>1423063338<\/creationTime>\r\n <memory snapshot='no'\/>\r\n <disks>\r\n <disk name='vda' snapshot='internal'\/>\r\n <disk name='hda' snapshot='no'\/>\r\n <\/disks>\r\n[..]\r\n<\/pre>\nStart VM and make some changes...and...Shutdown<\/strong><\/p>\n
\r\n# virsh snapshot-revert debian1 pre-update\r\n<\/pre>\nNow start VM and changes should be gone.<\/strong><\/p>\n
** Note when I created the snapshots using virsh they did not show up in virt-manager. Probably needs a refresh in virt-manager. Appears like a bug. When I create a new snapshot in virt-manager I can see both(virsh created and virt-manager created). Or cwhen I ompletely quit virt-manager and re-open I see all.<\/span><\/em><\/p>\n
Deletion of an old snapshot:<\/strong><\/p>\n
\r\n# virsh snapshot-delete debian1 pre-update\r\nDomain snapshot pre-update deleted\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"This article is for one specific use case I had. \u00a0There is a lot more written around snapshots, qemu and<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,25],"tags":[],"class_list":["post-833","post","type-post","status-publish","format-standard","hentry","category-kvm","category-virtualization"],"_links":{"self":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/posts\/833","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/comments?post=833"}],"version-history":[{"count":0,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/posts\/833\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/media?parent=833"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/categories?post=833"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/tags?post=833"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}