[libvirt-users] recovering from deleted snapshot

Peter Krempa pkrempa at redhat.com
Fri Jun 30 10:22:49 UTC 2017


On Fri, Jun 30, 2017 at 12:05:47 +0200, Peter Krempa wrote:
> On Thu, Jun 22, 2017 at 11:02:41 -0400, Doug Hughes wrote:
> 
> [...]
> 
> >  virsh blockcommit $vm $DISK --active --pivot
> > 
> > Normally this works fine, though something went wrong on the 20th.
> > something happened to make the blockcommit fail, but the -snap file got
> > deleted (note to self - check return code from blockcommit command!)
> > 
> > So now I'm in a state. The domain i still running. but it's running off
> > the -snapshot that is in the xml. I googled around for how to recover a
> > blockcommit from a deleted snapshot, but didn't find anything. (pointers
> > welcome)

In fact, it's way simpler. If libvirt still knows about the overlay
image (this is necessary only so that it can say the proper things to
qemu) you can re-do the block commit:

$ virsh list
 Id    Name                           State
----------------------------------------------------
 3     fedora23                       running

$ virsh snapshot-create-as --disk-only --no-metadata fedora23
Domain snapshot 1498817916 created
$ virsh domblklist fedora23
Target     Source
------------------------------------------------
vda        /var/lib/libvirt/images/fedora23.1498817916
hda        -

$ rm /var/lib/libvirt/images/fedora23.1498817916
$ ls /var/lib/libvirt/images/fedora23.1498817916
ls: cannot access '/var/lib/libvirt/images/fedora23.1498817916': No such file or directory
$ virsh blockcommit --active --pivot fedora23 vda

Successfully pivoted
$ virsh domblklist fedora23
Target     Source
------------------------------------------------
vda        /var/lib/libvirt/images/fedora23.qcow2
hda        -

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20170630/37ad8a91/attachment.sig>


More information about the libvirt-users mailing list