I have quite a large array of virtual machines that I use for a variety of purposes. From hosting development versions of my websites, to SVN, to Windows XP machines I can quickly VNC onto to test my stylesheets on Internet Explorer (we won’t go into that hell here!), there can be several machines running at any one time.

Occasionally, the host OS (in my case Ubuntu desktop) will lock up, or more commonly, become sluggish (it’s new favourite is excessive I/O wait) or simply have the GUI crash while services continue as normal. In these circumstances it would be great to be able so suspend some of my virtual machines (thereby saving their states) before rebooting the host machine. It turns out that this is actually possible. VMWare just happen to omit any mention of their free VMWare Player product from the documentation but it does work for VMWare Player. Simply download the VIX API from VMWare. You need to log into their site to get it for some annoying reason. The API pages are full of info about writing C programs to interface with the VMWare API but what we’re after is actually an application that comes with the API.

The application is called vmrun. VMRun allows most options to be run from the CLI including restart, shutdown and suspend. To suspend a virtual machine (on a linux host OS), simply use the following command:

vmrun -T player suspend /full/path/to/virtual/machine.vmx

Be sure to use the full path. The command can be easily run over ssh and has saved hard reboots for me on many occasions.

Leave a Reply

Your email address will not be published. Required fields are marked *