When you can't delete snapshot. What to do?
You know that one of the great features of VMware ESX is a possibility to take snapshot of your system on a regular basics. When something goes wrong, you just revert to the snapshot and here you go. But when the snapshot get's stuck? You want to delete a snapshot, but the task never ends. You can't power On the VM, it does not work…. and you can't stop the task of deleting snapshot either…
Here what you should try:
1. Connect to the ESX Host via SSH.
2. Run this command “Service mgmt-vmware restart” to restart the service.
3. If then the VM works, just leave like this, otherwise try to restart the ESX Host.
4. Open the snapshot manager of the VM and create a new snapshot. After, delete all previous snapshots and power On the VM.
Also there is a VMware kB article, which discusses this topic. Here is an extract from there:
Usually it's because of locked files. To resolve this issue, determine which process is holding the lock, then kill the process.
Note: The lock may also be held by a backup solution such as VMware Data Recovery or a Third party backup solution that has the vmdk mounted.
To determine which process is holding the lock, Run one of these commands:
lsof file
Or
lsof | grep -i file
For example:
# lsof | grep EAMTest02-flat.vmdk
You should see an output similar to:
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
71fd60b6- 3631 root 4r REG 0,9 10737418240 23533 EAMTest02-flat.vmdk
Note: If there are no results, run the command from the host where the virtual machine was previously (you can find that information on the virtual machine's Tasks & Events tab).
Check the process with the PID returned in step 1 with the command:
# ps -ef | grep
For example:
# ps -ef | grep 3631
The output appears similar to:
root 3631 3497 0 Jul11 pts/2 00:00:00 /tmp/.vzbin/146aa95d-a634-4c79-95c3-cbeb558fe1df/ac4cb87c-75c2-4142-9d15-b9f65b537c4a.bin -sBkDiff -F/vmfs/volumes/Disk-002/EAM01/EAM01_1-flat.vmdk -IP10.9.90.50 -P49153 -S256
To kill the process, run the command:
# kill
Malaysia VMware says
You can clone your VM and delete existing VM to solve the snapshot problem. Personally I would suggest not try to keep snapshot file bigger that 10G – Jas
Vladan SEGET says
Can I start cloning when there is a task in progress with the same VM? I don’t think so… -:)
Keme says
Hi Vladan – we tried delete all option but snapshot still exist in snapshot manager, we tried consolidate and it didn’t work, it suppose to merge it in to parent file,but no luck…. later we found out that it was our vcenter database sql server..and there is some issue with vmware itself when you snapshot a heavy iops database server, performance wise- you should do a article to explain consolidation vs delete all in snapshot…when have time- and thanks for your informative post like alaways.
Vladan SEGET says
Hi Keme,
Thanks for your input. It’s an older post, I might update it with some fresh content, concerning snapshots.
Yeah, snapshots can get out of control quite easy. In vSphere 6.0 the snapshot consolidation process uses a mirror driver. With the mirror driver mechanism, the changes to the VM as such are written to the active VMDK and the base disk during consolidation. A snapshot consolidations shall be completing in 1 pass, with minimal or no helper disks. This shall dramatically shorter stun time and offer a lower chance to have consolidation failure.
Matjaž Antloga says
it’s not always stucked, it can stay at 99% for a long time, my advice is to check .vmdk file sizes and times and see if there are any changes in a given time period. If there are, you better off leaving it to finish it’s job before doing anything stupid. Best regards, Matjaž