How to Clean Up Orphaned Libvirt Snapshots and Resolve “Deletion of External Disk Snapshots Not Supported” Error


9 views

During live disk backup operations using libvirt's snapshot functionality, you might encounter a situation where:

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

This typically occurs when:

  • The snapshot metadata exists in libvirt's records
  • The actual disk file (/srv/vm/snap.qcow2 in your case) is missing
  • You're no longer using the snapshot chain

First, verify the current disk chain:

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

Check for active snapshots:

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

When facing the "unsupported configuration" error, follow these steps:

  1. Stop libvirt daemon:
  2. # systemctl stop libvirtd
  3. Backup then remove the snapshot XML file:
  4. # mv /var/lib/libvirt/qemu/snapshot/prod/snap.xml ~/backup_snap.xml
  5. Restart libvirt:
  6. # systemctl start libvirtd

When creating temporary snapshots for backups, use --no-metadata:

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

This creates the disk snapshot without persistent libvirt metadata, avoiding the cleanup issue.

For advanced users, you can manage snapshots directly through QEMU:

# qemu-img snapshot -l /srv/vm/prod.qcow2
# qemu-img snapshot -d snapshot_id /srv/vm/prod.qcow2

However, this requires deeper understanding of QEMU internals.

After removal, confirm no snapshots remain:

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

Also check in virt-manager's GUI interface for visual confirmation.


During QEMU/KVM snapshot operations, you might encounter a situation where the disk image (snap.qcow2) gets deleted while the XML metadata remains in libvirt's tracking system. This creates an "orphaned" snapshot - one that exists in libvirt's records but has no corresponding disk file.

First verify the snapshot status:

# Check existing snapshots
virsh snapshot-list your-vm-name

# Examine disk chain
virsh domblklist your-vm-name
qemu-img info --backing-chain /path/to/main.qcow2

Libvirt currently lacks native support for cleaning up external snapshots. When you attempt deletion:

virsh snapshot-delete your-vm-name snapshot-name

You'll receive the error: unsupported configuration: deletion of 1 external disk snapshots not supported yet

Here's the complete step-by-step solution:

# 1. Shutdown libvirt (prevents conflicts)
sudo systemctl stop libvirt

# 2. Backup then remove the XML descriptor
sudo mv /var/lib/libvirt/qemu/snapshot/your-vm-name/snap.xml ~/backup/

# 3. Restart libvirt
sudo systemctl start libvirt

# 4. Verify removal
virsh snapshot-list your-vm-name

For future snapshot operations, consider these safer approaches:

# Option 1: Use --no-metadata for temporary snapshots
virsh snapshot-create-as --domain your-vm-name temp-snap \
  --diskspec vda,file=/path/to/temp.qcow2 \
  --disk-only --atomic --no-metadata

# Option 2: Proper cleanup sequence
virsh blockcommit your-vm-name vda --active --pivot
virsh snapshot-delete your-vm-name snapshot-name --metadata

After cleanup, ensure complete removal:

# Check all possible snapshot locations
sudo find /var/lib/libvirt/qemu/snapshot/ -name "*.xml" | grep your-vm-name

# Verify VM config
virsh dumpxml your-vm-name | grep -i snapshot

Only perform manual XML removal when:

  • The original disk image is confirmed gone
  • Standard deletion methods have failed
  • You've verified the snapshot isn't actively in use