Deleting a vps
To delete a vps for a cancelled customer, first we run the domUcancel.sh script which tries to shutdown the domU, then moves (mv) the /etc/xen/ file to /etc/xen/cancelled/. It runs "passwd -l" to lock their unix account on the dom0. 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. If diskdelete can't actually delete the volume, it will try to resize it to 256M and rename it with _deleteme after the name.
[nick@whetstone ~]$ ls -ltc /etc/xen/cancelled/higemaniya -rw-r--r-- 1 root root 357 Apr 23 2011 /etc/xen/cancelled/higemaniya [nick@whetstone ~]$ sudo -i diskdelete higemaniya Do you really want to remove active logical volume higemaniya? [y/n]: y Logical volume "higemaniya" successfully removed [nick@whetstone ~]$