Forrest logo
back to the virsh tool

virsh-undefine:tldr:efa61

virsh-undefine: Delete the configuration file and the specified storage volumes using the target name or the source name (as obtained from the `virsh domblklist` command).
$ virsh undefine --domain ${vm_name} --storage ${sda,path-to-source}
try on your machine

This command is using the "virsh" command-line tool to remove a virtual machine configuration file and any associated storage volumes. Here is the breakdown of the command:

  • "virsh": The command-line tool for managing virtual machines using the libvirt API.
  • "undefine": The subcommand used to remove a virtual machine configuration.
  • "--domain ${vm_name}": Specifies the domain (virtual machine) to be undefined. The "${vm_name}" is a placeholder that should be replaced with the actual name of the virtual machine.
  • "--storage ${sda,path-to-source}": Specifies a storage volume associated with the virtual machine to be undefined. "${sda,path-to-source}" is also a placeholder that needs to be replaced with the actual storage volume identifier or path to the storage volume source.

Overall, this command is removing the configuration and storage volumes of a virtual machine, ensuring it is no longer defined or accessible by the hypervisor.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the virsh tool