Friday, March 11, 2016

This is Part 2 of the short tutorial series:vSphere | Advanced snapshot troubleshooting

Virtual Machine consolidation attempts result with bellow error:Unable to access file since it is locked
Quick jump to:Part 1 | Part 3

Warning / Disclaimer!!

The steps and procedures described in this article contain low level commands and/or information on editing configuration files directly on ESXi hosts, all of which should be done by professionals.Further more, the examples here can only be used as a general guidelines on how to trobuleshoot the described problems, and do not provide the exact solution. I am not responsible for any damages done to your infrastructure by reproducing these steps. Proceed at your own risk!

First as it is mentioned you can try to migrate the VM to another host/datastore which will release the lock. It is advisable to do this with a powered off VM, especially if the VM is large and/or it is under heavy load. After the migration is done, there are usually two outcomes:

First outcome is that there is still a consolidation warning, and you are able to consolidate. In that case the problem is solved. Nice!

Alternatively you may notice that the consolidation warnings are gone. Or are they? Lets check and see for ourselfs. Time to hit the the ESXi shell:

Login to the host with SSH where the VM is located. Don't forget to enable SSH for that particular host too.

Remove all of the snapshots to consolidate:# vim-cmd vmsvc/snapshot.removeall 3463

The last command may take longer than expected so don't be afraid. The console must be running at all the time during this process. Don't disconnect or interrupt it anyhow or you risk bigger problems. You may also try to remove all the snapshots via the vSphere web client. If you feel that you want to monitor what is happening try and use some of the commands for monitor snapshot dentition at the beginning of this article.

Additional notes of "Things to attempt to solve the problem":

2. You may attempt to un-register the VM and then re-register it again. Right click on the VM within the vSphere Client and Remove it from Inventory. Than browse at the datastore where the VM is, right click at on the VM file and Add to Inventory. You can try registering the VM on another host, if you have one available. That will force the host to re-scan the VM and detect the snapshots. In any case then you may attempt to use the "Get new snapshot and delete all technique"

3. Try cloning the VM, however be advised that this is not that recommended as this will generate new ID. But if it solved the problem, then go for it.

In the next Part 3 we will go in-depth with solving an even more complex problem