What to do when you can’t delete snapshot

Fonte: http://www.vladan.fr/what-to-do-when-you-cant-delete-snaphshot/

What to do when you can’t delete snapshot

July 20, 2009 by Vladan SEGET 2 Comments

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

About Vladan SEGET

This blog is maintained by Vladan SEGET. Vladan is as an Independent consultant, professional blogger, vExpert 2009 - 2014, VCAP5-DCA/DCD, VCP 4/5. ESX Virtualization site has started as a simple bookmarking site, but quickly found a large following of readers and subscribers.

Connect on: Google + or Facebook. Feel free to network via Twitter @vladan.