I am currently busy with designing a migration strategy for a large ESX 2.5.2 migration to ESX 3.5 for one of our customers. (yeah I know, a little late ... but at least they will migrate immediately on the vShpere4 :))
While doing my tests and type the commands mostly only once and from then on use the arrow keys to go up to previous commands. You know how it goes: as lazy as you can get it ... :)
Anyways, I decided I would post most of these commands here. Not just for you guys, but admittingly also for myself as I regularly find myself looking through my memory for correct syntaxes ... :)
List files: vmware-cmd –lList path and names of .registered VM vmx files on the present host
Get state vmvmware-cmd /vmfs/volume/'vmfslabel'/'VMName'/'VMName'.vmx getstateRetrieve power state of the VM: off, on, suspended, stuck
Reboot vmvmware-cmd vmfs/volume/'vmfslabel'/'VMName'/'VMName'.vmx reset trysoft/hardReboot the VM. First try a nice shutdown (trysoft), then if necessary force a shutdown before reboot (hard).
Power on vmvmware-cmd vmfs/volume/'vmfslabel'/'VMName'/'VMName'.vmx startPower on the VM
Shutdown vmvmware-cmd vmfs/volume/'vmfslabel'/'VMName'/'VMName'.vmx stop trysoft/hardShutdown/halt the VM. First try a nice shutdown (trysoft), then if necessary force a shutdown (hard).
Suspend vmvmware-cmd vmfs/volume/'vmfslabel'/'VMName'/'VMName'.vmx suspendSuspend the VM
Verify snapshotvmware-cmd vmfs/volume/'vmfslabel'/'VMName'/'VMName'.vmx hassnapshotQuery if VM has a snapshot
Create snapshotvmware-cmd createsnapshot name description quiesce memoryQuiesce will quiesce file system writes, while Memory will grab the memory state
Revert to snapshotvmware-cmd vmfs/volume/'vmfslabel'/'VMName'/'VMName'.vmx revertsnapshotRevert to previous created snapshot (you loose the current VM state!)
Remove snapshotvmware-cmd vmfs/volume/'vmfslabel'/'VMName'/'VMName'.vmx removesnapshotsRemove previous created snapshots (you keep the current VM state!)
Register vmvmware-cmd -s register vmfs/volume/'vmfslabel'/'VMName'/'VMName'.vmxRegister VM (add to inventory)
Unregister vmvmware-cmd -s unregister vmfs/volume/'vmfslabel'/'VMName'/'VMName'.vmxUnregister VM (remove to inventory)
Answer vmvmware-cmd vmfs/volume/'vmfslabel'/'VMName'/'VMName'.vmx answeranswer pending request for userinput
Extend virtual Diskvmkfstools -X 12G ./testing.vmdkTo extend an existing Virtual Disk to 12GB.
Be aware if the shrinked size is smaller as the partition size in the guest there might be a data losse or a corrupted system resulting!
Copy virtual diskvmkfstools -i /vmfs/volumes/'vmfslabel'/'VMName'/'VMName'.vmdk /vmfs/volumes//'VMName'.vmdkCopy vmdk from one vmfs to another datastore
Export virtual diskvmkfstools -i /vmfs/'VMName'/'VMName'.vmdk -d 2gbsparse //'VMName'.vmdkExport vmdk to ext3 partition
Rename filesvmkfstools -ERename files associated with a specified virtual disk
Delete Virtualdiskvmkfstools -UDelete files associated with the specified virtual disk
Delete foldersrm –R –f /vmfs/volumes//VM folder>Delete non-empty folders
Find functionality | grep –i “”Example: vi *440*.vmx | grep –I “version”
Find a word with a file. In this example “version”
There are of course a whole lot more vmkfstools and vmware-cmd commands, but I think this gives a good start ...
Enjoy!