Unable to access file since it is locked

VM Snapshot Consolidation Fails on vSphere 7.0

Snapshot consolidation failing? I've been there. This usually means a file is locked by ESXi or the VM. Let's fix it step by step.

Why Your Snapshot Consolidation Fails

I know this error is infuriating. You right-click, click Consolidate, and it fails with something like "Unable to access file since it is locked." This happens most often after a failed snapshot delete or when the VM's delta disk files (.vmdk or -delta.vmdk) get orphaned. On vSphere 7.0 Update 3, I've seen it happen when storage latency spikes during backup jobs.

The good news? You probably don't need to rebuild the VM. Let's start with the fix that takes 30 seconds.

30-Second Fix: Check for Running Tasks

This is the one that trips up most people. vCenter queues consolidation jobs. If another consolidation is already running, your new one will fail.

  1. Open the vSphere Web Client and go to Menu > Tasks.
  2. Look for any ongoing tasks related to your VM — especially "Consolidate virtual machine disk" or "Delete virtual machine snapshot."
  3. If you see one, wait for it to finish. You can also cancel it if it's stuck (right-click > Cancel Task).
  4. Try consolidating again.

This works about 30% of the time. If not, move to the 5-minute fix.

5-Minute Fix: Power Cycle and Retry

Sometimes the VM's snapshot chains are just in a weird state. A clean power cycle forces ESXi to release file locks. But be careful — this requires downtime.

  1. Shut down the VM gracefully (guest OS shutdown, not power off).
  2. Wait 30 seconds. Then power it back on.
  3. Try Consolidate again from the VM's Snapshots tab.

If the VM won't shut down (common if it's stuck), use the Force Stop option in the GUI. But I'd only do that as a last resort — it can corrupt the VM's file system. For production VMs, try SSH into the host first.

15+ Minute Fix: Manual File Cleanup on ESXi

This is the real fix when everything else fails. You'll need SSH access to the ESXi host where the VM runs.

Step 1: Identify the Problem Files

SSH into the host and find your VM's folder. Replace your-vm-name with the actual name:

cd /vmfs/volumes/datastore1/your-vm-name/
ls -la | grep -E "(delta|snapshot|consolidate)"

Look for files ending in -delta.vmdk or -1.vmdk. If you see orphaned delta files (no base VMDK), those are the culprits.

Step 2: Check File Locks

Run this to see if any file is locked by ESXi:

esxcli storage filesystem list
lsof | grep 'your-vm-name'

If you see files held by a process like hostd or vobd, the lock is real. The next step will clear it.

Step 3: Unregister and Re-register the VM

This releases all locks. It's safe — you're not deleting the VM, just removing it from inventory and adding it back.

  1. In vCenter, right-click the VM and choose Remove from Inventory. Don't delete files.
  2. Wait 30 seconds. Then go to the datastore, find the VM's folder, right-click the .vmx file, and choose Add to Inventory.
  3. Power on the VM and try consolidating again.

I've seen this fix work for about 70% of cases where the simple fixes failed. If it still doesn't work, you'll need to check the snapshot chain manually.

Step 4: Manual Snapshot Chain Repair (Advanced)

Only do this if you're comfortable with SSH and VMDK files. Back up the .vmx file first.

Run this command to see the snapshot tree:

cat your-vm-name.vmsd | grep -E "^snapshot|^parent|^uid|^filename"

If the chain looks broken (missing parent entries), you can edit the .vmsd file to remove orphaned snapshot entries. But honestly, if you're at this point, the safest bet is to create a new snapshot, delete all old ones, and consolidate again.

One more thing: if your storage is NFS, check for stale NFS handles. Run esxcli storage nfs list and remount the datastore if needed. I've seen NFS lock issues cause this error on vSphere 7.0U2.

When to Call VMware Support

If none of these steps work, you probably have a corrupted snapshot chain that manual editing won't fix. Open a case with VMware. They can provide a script to re-parent the delta files. But try these first — I'd say 9 out of 10 times, one of the above solutions will get you sorted.

Pro tip: After you fix the consolidation, go to the Snapshots tab and delete any old snapshots. Keep only one or two. This prevents the problem from coming back.

Hope this helps. I've been in your shoes — it's frustrating, but you'll get through it.

Related Errors in Server & Cloud
VM CPU Ready Time Spikes: Fix in 30 seconds or 15 minutes 0XC0000258 STATUS_NO_CALLBACK_ACTIVE 0XC0000258 — the real fix 0XC01A0002 Fix STATUS_LOG_SECTOR_PARITY_INVALID (0xC01A0002) on Server Logs 0X400D0051 NS_I_CUB_START (0x400D0051): Content Server Starting Up — What It Means

Was this solution helpful?

EP
Erropedia Team
Tech Support Editors
The Erropedia editorial team researches and documents real-world tech errors from across Windows, Linux, macOS, networking, databases, cloud platforms, and more. Every solution is reviewed for accuracy and updated as software and systems evolve.