9

I am trying to live-snapshot using KVM as per this procedure.

I must have messed up at some point because I'm in a state I don't understand.

My VM is called prod. It was created in file /srv/vm/prod.qcow2.

Apparently, there is no running snapshot: I'm working on the base file. I can guess because the modification date of file /srv/vm/prod.qcow2 changes every minute or so. Besides, this command confirms it:

# virsh domblklist prod
Target     Source
------------------------------------------------
vda        /srv/vm/prod.qcow2

And there is nothing to blockcommit:

# virsh blockcommit prod vda --active --pivot
error: invalid argument: top '/srv/vm/prod.qcow2' in chain for 'vda' has no backing file

However, libvirt keeps trace of an old snapshot:

# virsh snapshot-list prod
 Name                 Creation Time             State
------------------------------------------------------------
 snap                 2015-06-09 12:11:33 +0200 disk-snapshot

Its descriptor file is /var/lib/libvirt/qemu/snapshot/prod/snap.xml:

<domainsnapshot>
  <name>snap</name>
  <state>disk-snapshot</state>
  <creationTime>1433844693</creationTime>
  <memory snapshot='no'/>
  <disks>
    <disk name='vda' snapshot='external' type='file'>
      <driver type='qcow2'/>
      <source file='/srv/vm/snap.qcow2'/>
    </disk>
  </disks>
[...]

The source file /srv/vm/snap.qcow2 was deleted.

Considering the method I'm trying to implement, it is pretty likely that this snapshot was created with the following command:

virsh snapshot-create-as --domain prod snap --diskspec vda,file=/srv/vm/snap.qcow2 --disk-only --atomic

I can't remove it:

# virsh snapshot-delete prod snap
error: Failed to delete snapshot snap
error: unsupported configuration: deletion of 1 external disk snapshots not supported yet

So I am in a state where a snapshot was created, is apparently no longer used, and can't be deleted.

Is there something I can do about it?

Should I care or can I just ignore it?

Edit

I just removed the snapshot file descriptor.

# systemctl stop libvirt
# mv /var/lib/libvirt/qemu/snapshot/prod/snap.xml /home/jerome
# systemctl start libvirt

My VM is up again and I don't see any reference to the snapshot anymore.

# virsh snapshot-list prod
 Name                 Creation Time             State
------------------------------------------------------------

Nothing in virt-manager either.

Am I fine or is there still some housekeeping to do?

Edit 2

Apparently, passing -–no-metadata to virsh snapshot-create-as would avoid this issue by not creating the .xml file, thus keeping no trace of the snapshot.

13

The proper method was

virsh snapshot-delete prod --metadata snap

(This command can be found on the wiki. I tried it before asking here but it failed due to a typo that has been corrected since.)

I don't know what it does that is not covered by removing the .xml file while libvirtd is down. Maybe the only difference is that stopping libvirtd is not needed. Even so, maybe this could evolve in the future. In any case, it is recommended to use libvirt's API rather than playing with files directly.

This call is indeed not needed if the snapshot was created with the --no-metadata argument.

I obtained this clarification in this thread of the libvirt-users mailing-list.

Anyone willing to do backups via live snapshots should read aforementioned wiki page, and may be interested in the forum thread which answers my noob questions, and points to slides from Eric Blake, as well as this blog post and following comments.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.