Removing VMware Snapshots – With a Bat (PowerShell, CLI, rCLI… and Perl)

by bunchc on January 19, 2009

I’ve found a few situations in which snapshots get stuck, like glue, to a running VM, and despite your best effort to delete them, they wont go away. Like in-laws, they stick around, a bit longer than is pleasant.

If a snapshot has not been removed cleanly on the first try, you may want to create a new snapshot first (just to make sure the system knows there IS a snapshot present) before using the methods below.

Here are a few ways of getting rid of the ones that don’t want to go away:

From the Service Console (ESX)

[root@esx esx:storage1]# vmware-cmd ./VMname/VMname.vmx removesnapshots
removesnapshots() = 1

From PowerShell

PS C:\> get-vm VMname* | get-snapshot | Remove-Snapshot -Confirm:$false

Using the rCLI

C:\Program Files\VMware\VMware VI Remote CLI\bin>vmware-cmd.pl -H esx -U root –P  password /vmfs/volumes/esx:storage1/VMname/VMname.vmx removesnapshots
removesnapshot () = 1

Using the Perl Toolkit

This brought to us by Andrew, an avid Perl Toolkit user:
./snapshotmanager.pl –server your.vc.host –operation removeall –vmname some.bad.vm

Warning, depending on the size of the snapshot, it may take a LONG while for them to go away! You can get an idea of how long it’s going to take by looking at how large the snapshots are with ls -lh and note the size of your largest snapshots. They bigger than a few deciGig (for those who don’t get it, that’s a few tens of Gigs, 10G-20G)? Shame on you.

  • http://www.get-admin.com Andrew

    Cody,

    If you have the Perl Toolkit installed, you can also use “snapshotmanager.pl”…

    ./snapshotmanager.pl –server your.vc.host –operation removeall –vmname some.bad.vm

    http://www.vmware.com/support/developer/viperlt

    Andrew

  • http://professionalvmware.com professionalvmware

    Thanks for that Andrew, post updated to reflect this as well. Now I need to
    pickup perl and add it to the arsenal as well… WEE!

  • http://www.elite-proxy.net Craigslist Proxy

    Some good points raised in that post. Will be back to check for more.

  • http://www.breastpumpdeals.com/medela-pump-in-style-advanced-metro-bag.html Medela metro bag

    Hey there, thanks for the information on this, you have been a great source for me, I am really very happy to have you in the list of bookmarks I have!

    Debra

  • http://professionalvmware.com professionalvmware

    Hey. No problem. Thank you!

  • http://sites.google.com/site/craigslistproxies/ Craigslist Proxy

    Nice one. I have stumbled and twittered this for my friends. Hope others find it as interesting as I did.

  • http://www.tourtravelchina.com/ China Tour

    Great post, what you said is really helpful to me. I can't agree with you anymore. I have been talking with my friend about, he though it is really interesting as well. Keep up with your good work, I would come back to you.

  • Fucking Machine

    Same here. It has definitely eased my mind on the bugging problem of stuck snapshots!

  • http://professionalvmware.com professionalvmware

    No worries. Thanks!

  • http://www.clubmz.com/ cell phone spy

    please change the back ground its really hard to read

  • http://www.massagershop.com/body-part/back-massager.html Back Massager

    Awesome! Thanks for sharing!

  • http://kam-pod.info/ Mark Smith

    Thanks for that!

  • http://www.savethislink.net/ social bookmarking

    Some snapshots made my host ran out of space. However, with the bat you gave, the problem was resolved. Thank you for a bat. LoL.

  • http://professionalvmware.com professionalvmware

    No problem!

  • http://www.funnyadultgamesplay.com/ adult games

    Nice..too technical for me…I am having some problem…I will ask my friend to take a look at this..

  • http://www.funnyadultgamesplay.com/ adult games

    Nice..too technical for me…I am having some problem…I will ask my friend to take a look at this..

  • tiffany1111
  • http://vibram4u.com/ moncler outlet store

    Hhe article’s content rich variety which make us move for our mood after reading this article. surprise, here wslmart.net you will find what you want! Recently, I found some wedsites which commodity is colorful of fashion. Such as xxxxxxxx that worth you to see. Believe me these websites won’t let you down.

  • http://hubpages.com/hub/cell-phone-spy-software Cell Phone Spy Software

    nice i love reading it…, you have been a great source for me, I am really very happy to have you in the list of bookmarks I have!

  • http://hubpages.com/hub/cell-phone-spy-software Cell Phone Spy Software

    nice i love reading it…, you have been a great source for me, I am really very happy to have you in the list of bookmarks I have!

  • http://www.be-long.com Choline Chloride

    I have not problem with that.

  • http://www.be-long.com Choline Chloride

    very good.

  • Bill

    You know those are just spam replies right…..

  • http://professionalvmware.com professionalvmware

    I do now. Thanks for the heads up.

  • http://www.facebook.com/people/Chellax-Cabtalan/100002369294421 Chellax Cabtalan

    nice post! very informative article, it deals with how we will be able to know about some parts and functions of the softwares.Second Hand Golf Clubs 

Previous post:

Next post: