Deleting a vps

From PrgmrWiki
Revision as of 07:26, 20 November 2012 by Nick (talk | contribs)

To delete a vps for a cancelled customer, first we run the script which tries to shutdown the domU, then moves (mv) the /etc/xen/ file to /etc/xen/cancelled/. This way, it can't be started again if the customer logs in. Later when we need more disk space, we look in /etc/xen/cancelled/ for files older than a month or so (ls -ltc /etc/xen/cancelled/ shows ctime and sorts by time shown) and run diskdelete on their disks to free the space. diskdelete can be run with -f to give force options to unpartitioning the disk and removing the logical volume. Of course, many variations on this process might make sense in various situations.

  • "find /etc/xen/cancelled -ctime 90" will print all the files with ctime older than 90 days in /etc/xen/cancelled

Many of the files in /etc/xen/cancelled will already have had their disks deleted also, so compare that list to the output of /usr/sbin/lvs. Guests whose name ends with a number will also have "nan" at the end so the disk name doesn't end with a number. When the name of the disk to delete is known from the domU config file, run the diskdelete script with the name of the disk.