vCLi command to remove a snapshot

DeathmageDeathmage Posts: 2,496Banned
Hey all,

So I'm curious I'm looking for a command to delete a orphaned snapshot.

So far I've been able to do the normal linux stuff like the following:

1. cd /vmfs/volumes/[volume with VM's]/VM01
2. ls -lah


I can see the orphaned snapshot, VM01-Snapshot1.vmsn - Now I'm curious what I need to do to remove it. Since it's orphaned the Snapshot Manager doesn't see it so this bring two issues one I need to delete the orphaned snapshot file and two I need to consolidate the VM manually.

So now I've run this command:

1. vim-cmd vmsvc/getallvms
2. taking note of the VM's VMID
3. I type this next: vim-cmd vmsvc/snapshot.get [VMID]
4. then I type vim-cmd vmsvc/snapshot.removeall [VMID]

However when I go back to the datastore the orphaned snapshot is still in the folder.

Anyone know how to forcefully remove a snapshot and then consolidate the VM? ... note: I've tried all the normal KB's from VMware on the topic but the pesky little rugrat won't die!!!


I'm going to try and make a new snapshot and then remove that one and see if it take the orphaned one with it....

Comments

  • jibbajabbajibbajabba Posts: 4,317Member
    .vmsn is the active state of a VM. Tried to power the VM off, remove and then consolidate via the client?

    Another trick which worked for me (in fact, since ESX3 or 4) is to power the VM off, create a new Snapshot and then hit 'remove all'. Now with 5.x you got the consolidation option too, worth shot.
    My own knowledge base made public: http://open902.com :p
  • jibbajabbajibbajabba Posts: 4,317Member
    And yes, I see you want to create a new one, still hit 'remove all's rather than deleting just the one created.
    My own knowledge base made public: http://open902.com :p
  • DeathmageDeathmage Posts: 2,496Banned
    Indeed, I got it to work with the remove all.

    The main reason for this was a friend called me up today from my former job, not sure if anyone remembers that Webjogger gig, he was the only competent person there and he liked me and we got along. Were still friends to this day and play hockey and go to the gym together... anyways hes a Cisco guy (hes been my RL cisco guy that I pick his brain) and he tried VMware but VMware is not his thing, networking is. ;)

    Long story short he has a customer that let a NAS datastore get to max size and they are having performance issues on VMware 5.0 Free and lo-an-behold they have a 2 year old orphaned Snapshot that is taking up 450 GB's of space. How it got orphaned my theory is when the server was 4.1 the IT person there upgraded to 5.0 and forgot to delete the snapshot or wasn't aware it was there and/or they did a NAS firmware upgrade and the snapshot got detached somehow during the firmware upgrade; obviously these are just IMHO theories.

    Now I tested this theory in my lab, hence the question, but now I have a 12 TB RAID 5 NAS with 6TB of free space and it went fine with the remove all with a forced orphaned snapshot; my friend has zero free space so he can't make a new snapshot and do a remove all. So I'm curious what else he can try minus adding a larger NAS to the customer network and moving the entire VM from the datastore to the new NAS and then doing the new snapshot and removing all.

    Thoughts?
  • jibbajabbajibbajabba Posts: 4,317Member
    Unfortunately that is the problem with 0 diskspace and snapshots - you need space to get space.

    Only thing you could try is either adding some more storage from somewhere temporarily or even local storage and move the VM over - mind you, you may need to do an old school *nix move operation to do that.

    I had to go to the extend once, with NO disk space anywhere near the DC (none I had access to anyway), I had to create an ISCSI target on my LAPTOP, attach it to the cluster, move the VM off, remove the snapshot, and move it back.

    That day (or better night) in the DC taught me one thing: Have an emergency Acronis iso / disk with you.

    Fastest way to be honest : Acronis the VM, delete it, re-create a blank VM and restore the image. Another option would obviously be VMware Converter, but with no disk space - there isn't probably anything to "convert" it to.

    So yea - image copy - delete - restore .... My $0.02 ....
    My own knowledge base made public: http://open902.com :p
Sign In or Register to comment.