6.0

Table Of Contents
VMware, Inc. 109
Chapter 8 Managing Virtual Machines
Taking Virtual Machine Snapshots
Youcantakeasnapshotwhileavirtualmachineisrunning,shutdown,orsuspended.Ifyouareintheprocess
ofsuspendingavirtualmachine,waituntilthesuspendoperationhasfinishedbeforetakingasnapshot.
Ifavirtualmachinehasmultipledisksindifferentdiskmodes,youmustshut
downthevirtualmachinebefore
takingasnapshot.Forexample,ifyouhaveaspecialpurposeconfigurationthatrequiresyoutousean
independentdisk,youmustshutdownthevirtualmachinebeforetakingasnapshot.
To take a snapshot
1 (Optional)Ifthevirtualmachinehasmultipledisksindifferentdiskmodes,shutdownthe
virtual
machine.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host>
/vmfs/volumes/Storage2/testvm/testvm.vmx stop soft
2 (Optional)Checkthattheshutdownoperationhasbeencompleted.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host>
/vmfs/volumes/Storage2/testvm/testvm.vmx getstate
3Runvmware-cmdwiththecreatesnapshotoption.
Youmustspecifythedescription,quiesceflag(0or1)andmemoryflag(0or1).
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
4Checkthatthevirtualmachinehasasnapshotbyusingthehassnapshotoption.
Thecallreturns1ifthevirtualmachinehasasnapshotandreturns0otherwise.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host>
/vmfs/volumes/Storage2/testvm/testvm.vmx hassnapshot
hassnapshot () = 1
Reverting and Removing Snapshots
Youcanusevmware-cmdtoreverttothecurrentsnapshotortoremoveasnapshot.
Runvmware-cmdwiththerevertsnapshotoptiontoreverttothecurrentsnapshot.Ifnosnapshotexists,the
commanddoesnothingandleavesthevirtualmachinestateunchanged.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host>
/vmfs/volumes/Storage2/testvm/testvm.vmx revertsnapshot
Runvmware-cmdwiththeremovesnapshotsoptiontoremoveallsnapshotsassociatedwithavirtual
machine.Ifnosnapshotexists,thecommanddoesnothing.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host>
/vmfs/volumes/Storage2/testvm/testvm.vmx removesnapshots
Powering Virtual Machines On and Off
Youcanstart,reboot,stop,andsuspendvirtualmachinesbyusingvmware-cmd.Youmustsupplyavaluefor
thepowerop_modeflag,whichcanbesoftorhard.
IMPORTANTYoucannotusevmware-cmdtoreverttoanamedsnapshot.UsethevSphereWebClienttorevert
toanamedsnapshot.
IMPORTANTYoumusthavethecurrentversionofVMwareToolsinstalledandrunningintheguestoperating
systemtouseasoftpoweroperation.