Pcornel
Browse topics
Options
Recent
Favorites
Virtualization · Technical reference

Delete

Direct 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.

When to use this

Use this when removing a VM safely, including its disks, backups, DNS, IPAM and monitoring entries.

First 30 seconds

1. Confirm backups and owner first.

2. Know whether disks are deleted with the VM.

3. Remove from backup jobs, HA and monitoring.

4. Release IPs and DNS.

5. Check for orphan disks later.

Operational verification

confirmation → backups checked → VM and disks removed → references cleaned

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
virtualization
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

Platformvirtualization
Scope / prerequisiteUse this when removing a VM safely, including its disks, backups, DNS, IPAM and monitoring entries.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

3 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Before deleting Verify boundary
  • Recent backup exists and is restorable.
  • No other VM uses its disks (linked clones, shared disks).
  • Owner confirmed.
Step 2 Common mistakes Narrow the fault
  • Removing from inventory and assuming files were deleted.
  • Deleting a parent of linked clones.
Step 3 Things to know Narrow the fault
  • Confirm a backup exists before deleting.
  • Hyper-V leaves disk files behind; vSphere "Remove from inventory" leaves files too.
  • Clean up DNS, monitoring, backup jobs and IPAM entries.
Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Key points
  • Confirm a backup exists before deleting from disk.
Key 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
ReferenceImportant terms & boundaries3 sections · depth on demand

In depth

Delete completely — and only what you mean to

PlatformCommandRemoves
libvirtvirsh undefine web01 --remove-all-storage --nvramDefinition, all disks listed in the XML, UEFI NVRAM file
libvirt (keep disks)virsh undefine web01 --nvramDefinition only — disks remain as orphans
Proxmox VEqm destroy 123 --purge 1 --destroy-unreferenced-disks 1Config, disks, and references in backup jobs, replication and HA

--remove-all-storage deletes every disk in the definition, including shared or attached data disks. Check first:

# virsh domblklist web01 --details
 Type   Device   Target   Source
------------------------------------------------------------
 file   disk     vda      /var/lib/libvirt/images/web01.qcow2
 file   disk     vdb      /srv/shared/data-common.qcow2
 file   cdrom    sda      /var/lib/libvirt/boot/debian.iso

Here vdb is shared — detach it (virsh detach-disk web01 vdb --config) before undefining with storage removal.

Pre-delete checklist

CheckReason
Final backup kept with a retention that outlives the VMAccidental or premature deletion
Linked clones that use this VM as a templateDeleting breaks them
DNS records, DHCP reservations, monitoring, firewall objectsStale references cause confusion and IP reuse problems
Licences and certificates bound to the VMReclaim or revoke
CMDB / inventoryKeep records accurate

Orphans after incomplete deletes

Disks left behind consume storage silently:

pvesm list local-zfs | grep -v -E 'vm-(101|102|...)-'     # Proxmox: volumes not owned by existing VMs
qm rescan                                                   # attach unreferenced disks as unused to their VMs
virsh vol-list default                                      # libvirt: compare with domblklist of all domains

Treat deletion as a change: schedule it, notify owners, keep the backup, and remove references in the same change.

*The virtual disk inventory and orphan-volume checks above are illustrative examples, not captured from a lab or production host.*

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

Commands

PlatformCommand
KVM/libvirtvirsh undefine vm01 --remove-all-storage
Proxmoxqm destroy 101 --purge
Hyper-VRemove-VM vm01 (disks stay — delete the VHDX files separately)
vSphereRemove-VM vm01 -DeletePermanently

Method

Deleting a VM removes its configuration and, usually, its disks. Before deleting:

1. Confirm the VM ID/name and owner — similar names are a classic error.

2. Check for snapshots, replication jobs, backup jobs and HA rules that reference it.

3. Decide whether to keep a final backup.

4. Remove it from monitoring, DNS, CMDB and firewall rules.

qm destroy 120 --purge --destroy-unreferenced-disks 1
virsh undefine vm1 --remove-all-storage --nvram
Remove-VM vm1     # Hyper-V keeps VHDX files — delete them separately
Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docvirtualization current

Authoritative/upstream documentation reviewed for bounded claims in Virtual Machine Lifecycle → Delete. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://libvirt.org/docs.html · confidence 94%
Confirmation

Confirm action

Continue?