vSphere 6.5

VMware Disk Consolidation unable to access file since it is locked

I wanted to write up a quick post concerning an error I received recently with consolidating disks on a few VMs.  Disk consolidation is needed when snapshot disks fail to compact after a Delete or Delete All operation or if the disk did not consolidate.  Sometimes a snapshot deletion doesn’t commit back to the base disk.  I had this warning in the summary of a particular VM I was working with recently.  However, when running the consolidate operation an ominous error presented – VMware disk consolidation unable to access file since it is locked.  Let’s take a look at this issue and how it was resolved in my case.

VMware Disk Consolidation unable to access file since it is locked

As mentioned above, in logged into the web client recently I saw a virtual machine that was presenting with the warning that Virtual machine disks consolidation is needed.  In looking at the issue initially my suspicion is the deltas were not committed in a backup software run that went down dirty perhaps.

consolidate01

Most know where to find this, but in case you didn’t know, you have the Consolidate option under your Snapshots menu.  Here you see it greyed out as this particular VM doesn’t need disk consolidation.

consolidate02b

The error I ran into was the below error.  When I kicked off the Consolidate process, it came back with a Unable to access file since it is locked error.

consolidate02

Resolution

There is a pretty helpful VMware KB article on Unable to delete the virtual machine snapshots issue.  One of the troubleshooting steps therein was to restart the management agents on the particular host the VM is running on.  It can be that the host has a lock on the disk files in question.  Thinking this could be the culprit, this is exactly what I did.  You can do this from the command line of the ESXi host itself by running the command:

services.sh restart

consolidate03

After restarting the management agents of the host the particular VM was running on, I was able to successfully run the consolidation process and delete the delta disks.

Thoughts

Snapshot delta disks are definitely a great tool to have when you need them and also the common way that most modern VMware backup software applications are able to grab quick and effective backups.  However, they can also be a sticky situation as well if you have a situation where you have orphaned delta disks as in my situation here.  This can happen as it did with me if you have a backup go down dirty or not commit snapshot changes correctly.  If you try and consolidate the delta disks and see the VMware Disk Consolidation unable to access file since it is locked error, restarting the management agents may do the trick as the host can have a lock on the files and prevent consolidation.

Subscribe to VirtualizationHowto via Email 🔔

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Brandon Lee

Brandon Lee is the Senior Writer, Engineer and owner at Virtualizationhowto.com and has over two decades of experience in Information Technology. Having worked for numerous Fortune 500 companies as well as in various industries, Brandon has extensive experience in various IT segments and is a strong advocate for open source technologies. Brandon holds many industry certifications, loves the outdoors and spending time with family.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.