“Virtual Machine Disks consolidation is needed” but consolidation button was grayed out

If you are here probably you need consolidation button was grayed out. Let's see how to recover it.

It has been a nightmare! If you are here probably you need consolidation button was grayed out.

I tell my story: I was deleting “all snapshot” taken for a virtual machine but it was taking too long so I decided to “cancel” the process because it was too late for me to wait.

After I cancelled the process of clearing snapshot, an event raised up on vsphere “Virtual Machine Disks consolidation is needed” 

Ok, perfect… let’s start consolidation… so I started consolidation but it was very very slow so I (genius!!!) cancelled even this process.

At this point vm went in unstable state, allarm “Virtual Machine Disks consolidation is needed” was still present and it was impossible to start VM or doing anything on this VM and the consolidation button was grayed out. 

vmware consolidate grayedout

Manually manage VM consolidation 

So some disks is pointing to broken snapshots (it could happened if you have multiple snapshot or if some backup fails ect ect). So now we have to manually check  the consistency of the snapshot-chain to perform consolidation.

DISCLAIMER: with this procedure you could demage your VM and it could be unrecoverable. It’s under your responsability if you apply this procedure and you loose your data.

Please note that this Procedure has been applyed on vmware 6.7 environment

Now follow this steps, for this example we assume that our vm to be consolidate is named “VM-OSTRICH”:

SSH login on host (esx) where your VM-OSTRICH is a guest

Find the file VM-OSTRICH.vmx 

#find / -name "*.vmx" 
#cd /vmfs/path_to/VM-OSTRICH

Check what disks/snapshots are being pointed:

#cat VM-OSTRICH.vmx | grep scsi*
scsi 0:0.fileName = "VM-OSTRICH.vmdk"

OR

scsi 0:0.fileName = "VM-OSTRICH-000002.vmdk"

VM-OSTRICH.vmdk means that you are not pointing a snapshot
VM-OSTRICH-00000X.vmdk means you are pointing a snapshot

Check what each snapshot is pointing to:

# cat VM-OSTRICH-000002.vmdk | grep parentFileNameHint

This command shows you what disk this snapshot points to next in the chain, it could be the base disk or another snapshot. If it is another snapshot you have to repeat the command until you find base disk.

If you have find something like VM-OSTRICH-000002.vmdk pointing VM-OSTRICH-000001.vmdk pointing VM-OSTRICH.vmdk you have to run vmkfstools on the highest point of the chain, so:

#vmkfstools -q -v10 VM-OSTRICH-000002.vmdk

Repeat all the steps until the .vmx file is pointing to base disk and now you should be able to “consolidate” your VM on vsphere (vmksftools should be run also on base disk as a last step).

I really raccomanded you to keep a backup of yout VM ready to be restored in case this procedure fails (there are lot of backup tools like Veeam, Arcserve, Bacula… 

This is where i find this procedure (god bless you)

Here is official documentation about “find” vmx files

Other articles about vmware