Sometimes after deleting snapshots or consolidating disks in virtual machines, you will start getting "Unable to access a file since it is locked" error on VMWare ESXi hosts.
Here at Ibmi Media, as part of our Server Management Services, we regularly help our customers to fix VMWare related errors.
In this context, we shall take you through the steps to fix this error.
More about "Unable to access file since it is locked" error on VMWare
When this error occurs, you will see an error message as shown below;
Unable to access file since it is locked.
An error occurred while consolidating disks: One or more disks are busy.
This VMWare error occurs after deleting a snapshot of virtual machines running on VMWare ESXi hosts.
Common factors which triggers this error include;
i. When some files with tags that are still in use by other ESXi hosts in the virtual machine.
ii.In cases where the backup session fails after adding virtual disks to the backup system.
How to fix "Unable to access file since it is locked" error on VMWare?
This error is due to a lock as a result of a process which is still running on the background. Therefore, we need to identity the locked files by following the steps below;
1. Start by logging into your server (ESXi host) via an SSH tool such as putty and navigate to the directory with the command below;
2. Check the vmware.log for consolidation and file locking errors with the command below;
cat vmware.log | grep lock
If you see that the errors logs messages looks like this;
VigorSnapshotManagerConsolidateCallback: snapshotErr = Failed to lock the file (5:4008)
2020-09-09T05:07:11.432Z| vmx| I125: DISK: Cannot open disk "/vmfs/volumes/5121c3ff-2303a3a-33bb-12345678221/mun-web02/mun-web02_3-000004.vmdk": Failed to lock the file (16392).
2020-09-09T05:07:11.432Z| Worker#1| I125: DISKLIB-LIB : Failed to open '/vmfs/volumes/5121c3ff-2303a3a-33bb-12345678221/mun-web02/mun-web02_3-000004.vmdk' with flags 0xa Failed to lock the file (16392).
2020-09-09T05:07:11.432Z| Worker#1| I125: DISK: Cannot open disk "/vmfs/volumes/5121c3ff-2303a3a-33bb-12345678221/mun-web02/mun-web02_3-000004.vmdk": Failed to lock the file (16392).
2020-09-09T05:07:11.432Z| vmx| I125: [msg.fileio.lock] Failed to lock the file
This means that the file "mun-web02_3-000004.vmdk" is locked. Now use the command below to show the current snapshot chain starting with the specified one to a flat disk;
vmkfstools -qv10 mun-web02_3-000004.vmdk
To unlock a VM file, restart the host with the command below;
Need support in deleting snapshots or disks of your virtual machine? We can help you today.