Snapshot consolidation needed fails with a lock message and this error message which I get mostly to fix once a week. Nowadays snapshot is been used very widely and regularly when we do any changes but this does create issues when we are not been regular to remove snapshots after we done with our activities. These issues also get into the picture when we have multiple snapshots for a single Virtual Machine – sometimes it does not get cleared during the snapshot deletion.

Firstly let me show you – How Snapshot consolidation needed fails with a lock message looks like?

You will see a warning message on virtual machine summary

Snapshot consolidation needed fails with a lock message

Snapshot consolidation needed fails with a lock message

  • Now your task is to clear this message for that you need to follow very simple steps as right click on virtual machine -> Snapshot->Consolidate
Snapshot consolidation needed fails with a lock message

Snapshot consolidation needed fails with a lock message

If you are luck then this goes ok for the first time and warning message is cleared up from the virtual machine.

Otherwise you will get an Error message as below

Snapshot consolidation needed fails with a lock message

Snapshot consolidation needed fails with a lock message

Ok Now – we will move into the options which we can do to fix the error on the virtual machine.

What Went Wrong !!! Why Snapshot consolidation needed fails with a lock message?

In my case we have an environment where we take esx level backup from 3rd party software like netbackup.

So the backup solution of Netbackup was trying to backup a Virtual Machine. A VMware-level snapshot was made; the base disk was hot-added to the VM that handles the backup. Then the backup was made.

After the backup was made however, the backup solution somehow did not manage to hot-remove the disks from the backup VM. This meant the base disks of the VM being backed up where still locked, hence the failure when trying to consolidate.

How to Fix Snapshot consolidation needed fails with a lock message?

There are few ways which you can opt for to fix this issue – you need to follow the below steps choose your methods.

Method – 1

Note the path of the disk files before removing or unlinking them from VM

You need to unlink your disk files /vmdk files from virtual machine (Do Not Delete the Disks – Only remove them from Virtual Machine)

Note: You VM must be Power off state when you do the complete activity

Once disks are unlinked from the VM – then you need to run Consolidate

Re-add disks from the datastore and power on your VM – Error message will be solved

–some peoples do also have success by restating the ESX management service from CLI “services.sh restart” but I don’t think this will help long term resolution.

Method – 2 (Best Option to fix the issue)

In this step you can solve the issue online – this means Virtual Machine will be stay powered on during this activity.

You need right click on VM and click Migrate – you need choose migrate disks to another available datastore  – this will clear lock on disk files of the virtual machine.

Once storage migration is complete then you can run the consolation and it will fix the issue.

Method – 3 (Good Option to fix – but you need extra space on datastore)

For this option you need to power off you virtual machine and then we will clone the vmdk and that will consolidate the all disks files which are linked to the main disk files of the VM.

Login to ESX / ESXi Server from ssh console to run the below command

From the ESX/ESXi terminal:

vmkfstools -i input output -d format -a adaptertype

From the ESX/ESXi terminal:

vmkfstools -i “/vmfs/volumes/Datastore/examplevm/examplevm.vmdk” “/vmfs/volumes/Datastore 2/newexamplevm/newexamplevm.vmdk” -d thin -a buslogic

Warning: If virtual machine snapshots or delta disks are present, ensure that the source chosen is the current snapshot delta disk. Failing to do so results in an outdated destination copy. However, when using the command, the corresponding descriptor file for the latest delta disk needs to be used when cloning the disk.

For example to clone and/or convert virtual machine disk with snapshot (otherwise known as a delta disk), examplevm-000001.vmdk and like above, from Datastore to Datastore 2 , with a thin-provisioned destination copy, run this command:

From the ESX/ESXi terminal:

vmkfstools -i “/vmfs/volumes/Datastore/examplevm/examplevm-000001.vmdk” “/vmfs/volumes/Datastore 2/newexamplevm/newexamplevm.vmdk” -d thin -a buslogic

 

Now once you are done then link new vmdk files which are cloned and you issue will be resolved and you can delete the old disk files once.

Resources from VMware

Use vmkfstools to clone disk:

http://kb.vmware.com/kb/1028042

 

Hope these above methods will help you to resolve issue of Snapshot consolidation needed fails with a lock message.

I am also looking on another scenario where I have same issue on a remote location and datastore is out of space – looking for a solution will update once I resolve that issue.

P.S – Do share your views and comments, thanks in advance.

newsletter-aik

Subscribe To Our Newsletter

Join our mailing list to receive the latest news and updates from our team.

You have Successfully Subscribed!