Posts Tagged ‘ssh’

Unable to commit snapshots because files are locked.

January 5th, 2012 No comments

I recently had an issue where the backup software had left a snapshot on the vm, which wasn’t visible in the snapshot manager.  Usually to get rid of this you would just snapshot the machine again, and the process would re-create the missing links.  Deleting the snapshots would then take the machine back to its usual state, happy days.  However this time that didn’t work, I could create snapshots, but couldn’t then commit them, resulting in a few snapshots being overlaid, but not showing up in the snapshot manager.  This was on ESXi 4.1, the backup software was VEEAM 5.

I did a bit of searching online, and found a couple of ways to remove the file locks which were showing up when trying to commit the snapshots.  The first option I tried was simply to disable the backup software which I thought might have the lock on the files.  Because of the situation I was unable to reboot the VM that was running the backup software.  This might have worked, but I don’t know for sure.

Next was to restart the management agents on the host.  Given I wasn’t onsite I wasn’t able to go in through the normal console, and restart the agents, luckily you can do the following.

  1. Connect using the vSphere Client
  2. Clicky on the Configuration Tab
  3. Clicky on the Security Profile link
  4. Properties
  5. Remote Tech Support (SSH)
  6. Options
  7. Start
This then allows you to ssh into the box, best practice says this should be turned off again once you have completed what you want to do.  Once you are SSH’d into the machine you can run a script to restart all the management services.
/sbin/ restart
Once I did this I was able to the snapshot the machine, and commit the snapshots, for me this took quite a while as the initial failed snapshot removal had happened quite a while ago.  The progress bar in the vSphere client sits at about 95% for a very long time.  You can use the following command from within the ssh terminal to check on the progress…
watch “ls *.vmdk”  * This works in esx(i) 4.1
I have included a link below to a site which provides more information on the above, and also additional switches etc to show more useful information.