Search code examples
virtual-machinevirtualqemusnapshotkvm

kvm virtual machine cannot delete a snapshot


I want to expand the disk capacity of the win7 virtual machine,but it prompts me that there are snapshots and cannot be expanded,but the snapshots cannot be deleted.

[root@jwf home]# qemu-img resize win7.qcow2 +30G
qemu-img: Can't resize an image which has snapshots
qemu-img: This image does not support resize
[root@jwf home]#

Use the qemu-img command to view the snapshot information.

[root@jwf home]# qemu-img info win7.qcow2
image: win7.qcow2
file format: qcow2
virtual size: 40G (42949672960 bytes)
disk size: 64G
cluster_size: 65536
Snapshot list:
ID        TAG                 VM SIZE                DATE       VM CLOCK
1         clean                     0 2019-10-18 14:41:10   00:00:00.000
Format specific information:
    compat: 1.1
    lazy refcounts: true

But I can't see the snapshot information using the virsh command.

[root@jwf home]# virsh snapshot-list win7
 Name                 Creation Time             State
------------------------------------------------------------

[root@jwf home]#

Unable to delete snapshot

[root@jwf home]# virsh snapshot-delete --domain win7 --snapshotname clean
error: Domain snapshot not found: no domain snapshot with matching name 'clean'
error: Domain snapshot not found: no domain snapshot with matching name 'clean'

[root@jwf home]# virsh snapshot-delete --domain win7 --snapshotname 1
error: Domain snapshot not found: no domain snapshot with matching name '1'
error: Domain snapshot not found: no domain snapshot with matching name '1'

No snapshot information is displayed in virt-manager.enter image description here

This virtual machine is imported by me,there is no snapshot configuration file

[root@jwf home]#
[root@jwf home]# ls /var/lib/libvirt/qemu/snapshot/win7/
[root@jwf home]#

Solution

  • Sometimes virsh and qemu see different things. This is occasionally because one of them is blind, and less frequently because one of them is hallucinating. In this case I believe virsh is blind. Try this:

    qemu-img info disk_image
    qemu-img snapshot -d snapshot_id disk_image
    qemu-img info disk_image