You can take virtual machine snapshots by using vmware-cmd.
You can take a snapshot while a virtual machine is running, shut down, or suspended. If you are in the process of suspending a virtual machine, wait until the suspend operation has finished before taking a snapshot.
If a virtual machine has multiple disks in different disk modes, you must shut down the virtual machine before taking a snapshot. For example, if you have a special-purpose configuration that requires you to use an independent disk, you must shut down the virtual machine before taking a snapshot.
Procedure
- (Optional) If the virtual machine has multiple disks in different disk modes, shut down the virtual machine.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx stop soft
- (Optional) Check that the shut down operation has been completed.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx getstate
- Run vmware-cmd with the createsnapshot option.
You must specify the description, quiesce flag (0 or 1) and memory flag (0 or 1).
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx createsnapshot VM1Aug09 'test snapshot August 09' 0 0
- Check that the virtual machine has a snapshot by using the hassnapshot option.
The call returns 1 if the virtual machine has a snapshot and returns 0 otherwise.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx hassnapshot
hassnapshot () = 1