Delete
Cheat sheet · https://pcornel.dk/topic.php?topic=3442
Answer
Deleting a VM removes it from inventory and, depending on the option, its disk files too (Delete from disk vs Remove from inventory, virsh undefine --remove-all-storage). Confirm backups and dependencies first; disk deletion is permanent.
Remember
- Confirm a backup exists before deleting from disk.
First checks
virsh undefine <vm> --remove-all-storage— delete VM and disks (libvirt)qm destroy <vmid> --purge— delete (Proxmox)Remove-VM <vm>; then delete VHDX files— Hyper-V keeps disks unless removed
Commands
virsh undefine web01 --remove-all-storage --nvramvirsh undefine web01 --nvramqm destroy 123 --purge 1 --destroy-unreferenced-disks 1virsh detach-disk web01 vdb --configvirsh undefine vm01 --remove-all-storageqm destroy 101 --purge
Verify in this order
confirmation → backups checked → VM and disks removed → references cleaned
Where it usually breaks
First mismatch in management intent → host/cluster capability → hypervisor runtime/task → virtual resource/device → guest state → workload-visible read-back; preserve identity/native error/pre-state before mutation.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=3442