XenServer

Delete VMs

You can delete VMs by using the xe CLI or XenCenter.

Deleting a virtual machine (VM) removes its configuration and its filesystem from the host. When you delete a VM, you can choose to delete or preserve any virtual disks attached to the VM, in addition to any snapshots of the VM.

Delete a VM by using the xe CLI

To delete a VM:

  1. Find the VM UUID:

    xe vm-list
    
  2. Shutdown the VM:

    xe vm-shutdown uuid=<uuid>
    
  3. (Optional) You can choose to delete the attached virtual disks:

    1. Find the virtual disk UUIDs:

      xe vm-disk-list vm=<uuid>
      
    2. Delete the virtual disk:

      xe vdi-destroy uuid=<uuid>
      

    Important:

    Any data stored in the VM’s virtual disk drives is lost.

  4. (Optional) You can choose to delete the snapshots associated with the VM:

    1. Find the UUIDs of the snapshots:

      xe snapshot-list snapshot-of=<uuid>
      
    2. For each snapshot to delete, find the UUIDs of the virtual disks for that snapshot:

      xe snapshot-disk-list snapshot-uuid=<uuid>
      
    3. Delete each snapshot disk:

      xe vdi-destroy uuid=<uuid>
      
    4. Delete the snapshot:

      xe snapshot-destroy uuid=<uuid>
      
  5. Delete the VM:

    xe vm-destroy uuid=<uuid>
    

Delete a VM by using XenCenter

To delete a VM:

  1. Shut down the VM.
  2. Select the stopped VM in the Resources panel, right-click, and select Delete on the shortcut menu. Alternatively, on the VM menu, select Delete.
  3. To delete an attached virtual disk, select its check box.

    Important:

    Any data stored in the VM’s virtual disk drives is lost.

  4. To delete a snapshot of the VM, select its check box.
  5. Click Delete.

    When the delete operation is completed, the VM is removed from the Resources pane.

Note:

VM snapshots whose parent VM has been deleted (orphan snapshots) can still be accessed from the Resources pane. These snapshots can be exported, deleted, or used to create VMs and templates. To view snapshots in the Resources pane, select Objects in the Navigation pane and then expand the Snapshots group in the Resources pane.

Delete VMs