Virtual Machine Disks Consolidation Needed - How to Fix it!
Having your virtual machines hosted on VMware vSphere servers has a lot of advantages, one of which is easy access to a plethora of server management solutions and advanced VM management tools. VMware vSphere also offers high performance and reliability, provided you’re using a decently specced system to host the VMs.
But even though VMware vSphere is considered one of the best and most reliable virtualization environment platforms, it is not “perfect.” Sometimes, you might see an error message on the VM summary tab that reads “Virtual machine disk consolidation is needed,” this might trigger serious concerns as you wouldn’t like to lose any important data saved on the VM. How do you fix this?
What is Disk Consolidation?
There are other reasons why you may get the disk consolidation error notice, and the appearance of this message can degrade the related VM’s performance and health. To carry out disk consolidation on a VM means to merge “orphaned” virtual disk files generated from snapshots with their main VMDK files, which helps to free up storage space too.
The disk consolidation notice may appear after you recently deleted a snapshot. It is a snapshot-related error and can actually be fixed following a few simple steps. Typically, the error shows when you delete snapshots but have leftover files on the disk that could not get merged with the main VMDK file, more like orphaned files, but that’s not the case here.
Any VM that shows a disk consolidation notice cannot be further backed up until the error is fixed. Fixing this is mainly cleaning up the discrepancies of the snapshots you edited/deleted recently. This is a system-level action, and it’s advisable to be careful with the steps to avoid losing the VM data totally.
Why Did the “Virtual Machine Disks Consolidation is Needed” Error Appear?
Here are some of the most common reasons why you’re seeing the error message on your VM summary page.
- Insufficient free space on the VMFS datastore for disk consolidation to occur automatically. You need at least 1 GB of free space for disk consolidation.
- Timeouts due to large snapshots cause poor storage performance.
- Temporary network connection problems between the vCenter server and the ESXi host.
- Ongoing VM backup processes by a third-party app or the snapshot files are locked by vSphere. Close all running VM backup processes.
- The virtual machine already has more than 32 snapshots. VMware recommends that each VM has a maximum of 32 snaps.
- There’s an ongoing process of large snapshots consolidating in the background.
Is It Compulsory to Consolidate Virtual Machine Disks?
When you take multiple snapshots of a VM, it is important to merge the data from the delta disks (formed at each snapshot) into a single disk so no redundant data is left orphaned on the datastore where the VM’s files are stored. Each time you run disk consolidation, your storage space gets cleaned up.
So, yes, disk consolidation is required for the effective performance of your virtual machines. If the system cannot perform consolidation automatically due to any of the reasons listed above, then you should do it manually. Until disk consolidation is done, the VM monitor will not show your deployed guest OS in a Healthy state.
Disk consolidation frees up more space by merging virtual disk files created after taking snapshots to ensure effective performance. Your VMs won’t be powered down during consolidations. If consolidation doesn’t occur automatically, you can trigger it manually after creating a snapshot or when the error message shows up, to avoid performance degradation and other issues.
Note: If disk consolidation is not done, the VM won’t run optimally and you may run into several other problems randomly.
How to Fix the “Virtual Machine Disk Consolidation is Needed” Error
There are a couple of ways to clear this error message from your VM’s monitor page. These five methods are the most effective.
1. Consolidate Virtual Machine Disk Files Correctly
Consolidating the faulty VM from the vSphere web client application is the easiest way to fix and clear this error message. Here’s how to do it:
- Log into your vSphere Client and go to the VMs tab
- Select the VM that showed you the error message, right-click on it, and select Snapshots
- Click on the Consolidate context option, and select “Yes” on the pop-up dialogue box. If your snapshots are large, it may take some time for the consolidation to complete.
2. Delete Snapshots in Snapshot Manager
Alternatively, if you have more than 32 snapshots of a VM, you may need to delete some of them as VMware suggests a maximum of 32 snaps per VM. Deleting a snapshot can be done in Snapshot Manager.
- Log into your vSphere Client and go to the VMs tab
- Select the VM that showed you the error message, right-click on it, and select Snapshots.
- Click on “Manage Snapshots” and delete the snapshot you feel like deleting. You can equally delete all snapshots you have recorded by clicking the “Delete All Snapshots” option.
3. Consolidate Snapshot via Command-Prompt
If you’re familiar with the PowerCLI interface and would prefer it over the GUI-based vSphere Client, you can run some commands to commit the problematic snapshot for consolidation.
- Connect to the vCenter server: Connect-VIServer -Server [server name] -Protocol [http] -User [username] -Password [password]
- Confirm the VM that needs to be consolidated: Get-VM | Where-Object {$_.Extensiondata.Runtime.ConsolidationNeeded}
- Consolidate the VM disk of the virtual machine that needs consolidation, in this case, “testVM”: (Get-VM -Name "testVM").ExtensionData.ConsolidateVMDisks()
Note: If more than one VM needs consolidation, you can consolidate all of them using the following command:
Get-VM | Where-Object {$_.Extensiondata.Runtime.ConsolidationNeeded} | foreach {$_.ExtensionData.ConsolidateVMDisks_Task()}
4. Unlock The VM Files and Consolidate The VMDK Using vSphere Client
Another way to work this error around is by unlocking any of the VM’s files that might have been locked by a backup application. Hereunder are the steps to follow:
Hot Tip: You can restart ESXi management agents from the “Troubleshooting Options” in ESXi direct console. For CLI commands, follow below:
- Restart the management agents of the primary ESXi host where the VM is deployed. This is done by connecting to the ESXi host via SSH or using ESXi shell CLI. Run any of these commands to restart the host’s services:
- services.sh restart
or
- /etc/init.d/hostd restart
- /etc/init.d/vpxa restart
- Check for the locked VM files:
- vmfsfilelockinfo -p /vmfs/volumes/vm_datastore/vm_name/vm_name.vmx
- Confirm the path of the VM’s log files in datastore:
- cat /var/log/hostd.log |grep -i vm_name
- Go to the VM directory since you’ve identified the path:
- cd /vmfs/volumes/datastore_name/vm_name
- List ESXi hosts locked by the VM files:
- for i in `ls`; do vmfsfilelockinfo -p $i ;done|grep ‘is locked in\|Host owning the lock\|Total time taken’ | sed ‘s|Host owning the lock on file is||g’|sed ‘s|Total time|—|g’ | awk ‘{print $1}’ |uniq
- Restart ESXi management agents and unlock the VM files:
- /etc/init.d/hostd restart
- /etc/init.d/vpxa restart
Once this is done, you can now consolidate the virtual machine disk files using the vSphere Client app to clear the error.
Tip: Learn how to reset VMware virtual machine!5. Extend Your Disk Space
Finally, by extending your disk space, you can fix VM consolidation errors. This is because sometimes, the error is shown when there’s less than 1GB of free space for disk consolidation. However, this will require getting a third-party partition management software. Using partition management software, you can further extend the disk capacity of your VMFS volume/partition. The VMFS partition is what stores your VMDK files, which are the virtual hard drives powering your VMs.
How to Backup Your VM Data
Snapshots are not the same as local backups, so even if you make 30 snapshots, one locally updated backup is more reliable than those 30 snaps. That said, it is advisable to make regular backups of your VM data files.
There are many VM data backup applications, including DiskInternals VMFS Recovery, which allows you to clone the hard drive where your VMware’s VMDK files are stored. DiskInternals VMFS Recovery clones hard drives in image format and you can restore the backup at any time.
Interestingly, the software can be used to launch data recovery on ESXi hosts to recover any lost VM file. DiskInternals VMFS Recovery is available for all Windows OS editions and versions, and it uses minimal system resources. Recover VMware virtual machine with ease!
Conclusion
The “virtual machine disk consolidation is needed” error is a snapshot-related problem; it can also appear due to low storage space. Thus, by expanding your VMFS partition size or deleting some large snapshots, you should be able to consolidate the VM and clear the error message.
FAQ
Why disk consolidation is needed in VMware?
The "virtual machine consolidation needed" status typically arises from two main issues: insufficient disk space on the VMFS datastore for consolidating VM snapshots and virtual disk files. This error is likely to happen if the datastore has less than 1 GB of available space.
Can I stop disk consolidation VMware?
Caution: Once initiated, the consolidation process cannot be halted. During this procedure, you can observe the LUN's throughput (measured in reads and writes per MB/sec) where the virtual disk is located by utilizing esxtop. This allows you to approximate the duration of the process by considering the total size of the delta files.
How do I fix disk consolidation issue in VMware?
Should you encounter a consolidation problem while the virtual machine is operational, initiate a consolidation task to generate a fresh batch of log entries, aiding in the diagnosis of the issue. However, if the virtual machine does not start, bypass this recommendation and proceed to Step 3. For identifying a disk lock, ensure all anticipated locks on the disks are removed.
What is the purpose of snapshot consolidation on a VM?
Consolidation of VM Snapshots involves amalgamating various snapshots of a virtual machine into one unified snapshot file. This method is effective in decreasing disk space usage and enhancing the performance of the virtual machine.