How do I completely delete an old VM in a Xen host?

I want to reinstall the vm new from scratch with

xen-create-image --hostname=something --size=8Gb --swap=2Gb --memory=1Gb --ip= --dist=jessie

I already shut it down with

xl destroy something

but I want to get free of the disk-space and create the whole virtual-mashine new. If I just try to recreate it now with the xen-create-image command, I get an error

Configuration file already exists; /etc/xen/something.cfg 
  • 1
    rm /etc/xen/something.cfg? To overwrite the last disks with the same name, I think just using -fworks too. – Ziazis Jul 7 '17 at 9:50
  • Which version of XenServer are you using? – Amit24x7 Jul 7 '17 at 9:58

To list the VMs on the server:

xe vm-list

To remove, you first need to shut it down then destroy it.

xe vm-shutdown uuid=<uuid-of-vm>
xe vm-destroy uuid=<uuid-of-vm>

To destroy storage repository (SR):

xe sr-list
xe pbd-unplug uuid=<uuid-of-pbd>
xe sr-forget uuid=<uuid-of-sr>

To remove virtual disks (VDI):

xe vdi-destroy uuid=<uuid-of-vdi>
| improve this answer | |

You can just recreate with with the option --force (-f is ambigious):

xen-create-image --force --hostname=something --size=8Gb --swap=2Gb --memory=1Gb --ip= --dist=jessie
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.