2

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=10.77.77.105 --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 
2
  • 1
    rm /etc/xen/something.cfg? To overwrite the last disks with the same name, I think just using -fworks too.
    – Ziazis
    Jul 7, 2017 at 9:50
  • Which version of XenServer are you using?
    – Amit24x7
    Jul 7, 2017 at 9:58

2 Answers 2

2

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>
0

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=10.77.77.105 --dist=jessie

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .