Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

14.8.5. Undefining a Domain

# virsh undefine domain --managed-save --snapshots-metadata --storage --remove-all-storage --wipe-storage
This command will undefine a domain. Although it can work on a running domain, it will convert the running domain into a transient domain without stopping it. If the domain is inactive, the domain configuration is removed.
The command can take the following options:
  • --managed-save - this option guarantees that any managed save image is also cleaned up. Without using this option, attempts to undefine a domain with a managed save image will fail.
  • --snapshots-metadata - this option guarantees that any snapshots (as shown with snapshot-list) are also cleaned up when undefining an inactive domain. Note that any attempts to undefine an inactive domain whose configuration file contains snapshot metadata will fail. If this option is used and the domain is active, it is ignored.
  • --storage - using this option requires a comma separated list of volume target names or source paths of storage volumes to be removed along with the undefined domain. This action will undefine the storage volume before it is removed. Note that this can only be done with inactive domains. Note too that this will only work with storage volumes that are managed by libvirt.
  • --remove-all-storage - in addition to undefining the domain, all associated storage volumes are deleted.
  • --wipe-storage - in addition to deleting the storage volume, the contents are wiped.