Martijn Lammerts
My own digital place with a little of everything

VMware Command Line Tools

3 July 2008

VMware Command Line Tools

Manage virtual disks at the service console command line.

The command -X can be used to extend the size of your virtual disk. Example: You have a 5GB virtual disk and wanted to expand it to 15GB, you use the following command.
The VM need to be powered off!

vmkfstools  -X 15GB /vmfs/volumes/storage/virtualmachine.vmdk
-X switch specifies the new size of the virtual disk and not how much you are extending it by.

Most used of this command is to register/un-register or power on/off/restart VMs from the console command line.

– register VMW:
vmware-cmd -s register /vmfs/volumes/storage/vmw/vmw.vmx 

– unregister VMW:
vmware-cmd -s unregister /vmfs/volumes/storage/vmw/vmw.vmx

– Start VMW:
vmware-cmd /vmfs/volumes/storage/vmw/vmw.vmx start
– Restart VMW:
vmware-cmd /vmfs/volumes/storage/vmw/vmw.vmx reset
– Shutdown:
vmware-cmd vmfs/volume/storage/vmw/vmw.vmx stop  or
vmware-cmd vmfs/volume/storage/vmw/vmw.vmx stop hard
– Suspend:
vmware-cmd vmfs/volume/storage/vmw/vmw.vmx suspend

vmware-cmd -l
List path and names of registered VMW vmx files on the present host
vmware-cmd /vmfs/volume/strorage/vmw/vmw.vmx getstate
Retrieve power state of the VMW: off, on, suspended

vmware-cmd vmfs/volume/storage/vmw/vmw.vmx hassnapshot
Query if vmw has a snapshot

vmware-cmd /vmfs/volumes/storage/vmw/vmw.vmx createsnapshot
Create a snapshot

vmware-cmd /vmfs/volumes/storage/vmw/vmw.vmx revertsnapshot
Revert to a previous created snapshot, the current VM state will be losed.

vmware-cmd vmfs/volume/vmfslabel/VMName/VMName.vmx removesnapshots
Remove snapshot.

vmware-cmd vmfs/volume/vmfslabel/VMName/VMName.vmx answer
answer pending request

Command to monitor snapshot deletion:
During the snapshot deletion process, it is difficult to observe the progress. While the snapshot deletion is taking place, the following occurs:

  • The hostd process does not respond
  • It is difficult to determine status of snapshot deletion

#watch “ls -lhut –time-style=full-iso *.vmdk”