January 2014 Archives

Fri Jan 10 12:01:44 ICT 2014

Reset the virtual machines at the end of a semester

After a semester, when WEA or SAD class is over, you must reset the machines web1... web15 or sad1-a... sad5-b.

The following script erase the permissions and reset the hard disks, so you don't have to VMware GUI and reset machine by machine by hand.

  1. Login on the VMware server:
    $ ssh root@virtual3
    
  2. Call the script for one or more WEA virtual machine. For the machine web1 use the pamater 1, use 2 for web2, etc.:
    $ /vmfs/volumes/datastore1/ghettoVCB/reset-vm.sh machinea machineb...
    The shell script does the following:
    • stop the virtual machine
    • find and remove any permission associated to the VM
    • delete the virtual disk, care is taken to fine the proper xxx-flat.vmdk file
    • delete any log
    • delete any NVRAM (*.nvram, in case of WEA machines, the file is always web1.nvram) because all machines were cloned from web1)
    • delete any lock file
    • delete any swap file
    • remove any files used by snapshots
    • remove the file linked to VMware tools
    • recreate an empty virtual disk with the same name used at deletion step above, make the disk accessible only by root
    • Automatically add permission for Matt on all the WEA virtual machines

Posted by Olivier | Permanent link | File under: administration, vmware