vSphere Snapshot Consolidation

I’ve written a post recently around creating snapshots using the ESXi CLI. Further to that, I thought I’d cover a bit on Snapshot Consolidation With vSphere 5, a new feature was added to allow you to consolidate snapshots. This was done to address an issue where, when doing a snapshot removal, the delta files would not be merged with the base disk but would be removed from visibility in the vSphere client. This could lead to problems where a VM that didn’t look as though it had any active snapshots, was still actually writing to the delta files.

Now, when a VM has had issues consolidating its snapshots you will see a message on the Summary tab for the virtual machine:

When you see this, you can run a Consolidation on the virtual machine to commit the delta files to the base disk:

If you want to test the process, create a snapshot on your virtual machine, then run the following in PowerCLI:

This will remove the snapshot, without committing the delta files. You should immediately get the ‘needs consolidation’ message in the vSphere client. If you look at the contents of the *.vmsd file in the virtual machine’s working directory, you should see the following if consolidation is required:

/vmfs/volumes/4f27b82e-3fc1540e-bf6b-000c295da2d9/XP3 # cat XP3.vmsd
.encoding = "UTF-8"
snapshot.lastUID = "7"
snapshot.needConsolidate = "TRUE"

Using PowerCLI to Find Virtual Machines that need Snapshot Consolidation

You can use PowerCLI to list all VMs that need consolidation by running:


Get-VM | Where-Object {$_.Extensiondata.Runtime.ConsolidationNeeded}

If any are found, you can start a consolidation task by running:


(Get-VM -Name "VirtualMachineNameGoesHere").ExtensionData.ConsolidateVMDisks_Task()

Useful Links and Resources

https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1002310

https://blogs.vmware.com/vsphere/2011/08/consolidate-snapshots.html

Related posts

VMware vSphere Virtual Machine Snapshots Explained

How to Enable SSH on All ESXi Hosts using PowerCLI

How to Install VMware Tools on Debian 11

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Read More