bart5555
Contributor
Contributor

remove last snapshot from command line

Hi,

Is there any way to remove last snapshot ( merge last snapshot into VM without powering off VM) using command line in ESX 4? (I don't want to remove all snapshots using vmware-cmd removesnapshots).

Thanks

Bart

0 Kudos
1 Reply
lamw
Community Manager
Community Manager

If you want to do this via the classic ESX Service Console, you can take a look into vimsh for your snapshot operation:

[root@himalaya ~]# vmware-vim-cmd vmsvc/snapshot.remove
Insufficient arguments.
Usage: snapshot.remove vmid [removeChildren] [snapshotLevel] [snapshotIndex]

Remove a snapshot on the vm.

I forget offhand which way the index level grows, you may want to do some testing but I think you just need to modify the last param snapshotIndex and it'll either start 0 and grow or the opposite value.

A more elegant solution is to use the vSphere SDK/VI SDK which allows you to just remove a particular snapshot by name RemoveSnapshot_Task() http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.vm.Snapshot.html#remo... but this will require you to run a script outside of the ESX Service Console on either a Windows/Linux or on vMA

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

Twitter: @lamw

If you find this information useful, please award points for "correct" or "helpful".

0 Kudos