Unable to delete the virtual machine snapshot due to locked files

Sometimes my backup application (Netbackup) finds a way to be the source of complete frustration. When backing up a virtual machine it gets stuck and does not progress and then when you cancel the job the snapshot that it had created for the backup does not get deleted from vcentre.

So typically, I wait for sometime for the snapshot to get deleted but it does not happen and that drives me mental, so I delete that manually from the vcentre interface. After that I encounter a different problem which does not let me create any new snapshot on that VM and whenever I do.. I get the below message.

Unable to access file [unspecified filename] since it is locked

 

There are a few things you can do to fix this and here is what I typically try..

  • Try creating a new snapshot on the VM and if you are lucky and  that gets created then go back to  the snapshot manager and say "Delete All"
  • Try and run a consolidation on the target VM
  • Vmotion the virtual machine to a different host and then try creating the snapshot.
  • Try and storage vmotion this virtual machine to another data store and if that is successful try performing the above 2 steps again once migrated.

In my experience none of the above methods worked but what did work is when I SSH into the target host using PUTTY and restart the management agent services it fixes this issue. So when you are at the command line of the host run  the below command. It will restart all the services and don't worry none of your virtual machines will get affected.

services.sh restart

Note: In case you are really paranoid before running the above command you can vmotion off the VM's to different hosts and then run the command and in case you don't have enough resources than tough luck! When the service is being restarted for a brief moment the ESXi host will get disconnected from you vcentre interface but don't worry once the service is back up, it connects automatically.

-Alstar