Snapshot consolidation is a common request asking "why the processes take so long to complete?" and the browser tool only provides an estimated percentage bar which can fluctuate reporting percentages. A better way to analysis snapshot consolidation is demonstrated below.
Perform a snapshot deletion prior a snapshot consolidation. When deleting the snapshots, all changes merge with the base virtual machine disk. Snapshot consolidation is useful when snapshot disks fail to compact after a Delete or Delete all operation or if the disk did not consolidate. This might happen, for example, if you delete a snapshot but its associated disks do not commit back to the base disk.
Symptoms:
The virtual machine's Summary tab shows Needs Consolidation.
To determine the total of all the VM snapshots in the VM directory, change directory to the virtual machine for snapshot consolidation run the command:
cd /vmfs/volumes/datastore/vm/
ls -lah
Virtual Machine directories with no sesparse files run this command:
ls -la |grep delta |awk '{print $5}' | awk '{ SUM += $1/1024/1024} END {print "total of all snapshots " SUM "MB\n"}'
ls -la |grep delta |awk '{print $5}' | awk '{ SUM += $1/1024/1024/1024} END {print "total of all snapshots " SUM "GB\n"}'
or
VM directories with sesparse files run this command:
ls -la |egrep -i 'delta|sparse' |awk '{print $5}' | awk '{ SUM += $1/1024/1024} END {print "total of all snapshots " SUM "MB\n"}'
ls -la |egrep -i 'delta|sparse' |awk '{print $5}' | awk '{ SUM += $1/1024/1024/1024} END {print "total of all snapshots " SUM "GB\n"}'
Justification for snapshot deletion or disk consolidation is usually back-ups or disk space.
The error message for a disk space issue will report in the web browser as a pop-up window
"An error occurred while consolidating disks"
To consolidate the snapshots the disk space available must be 1.5 times the total of all snapshots in that directory.
99% Used will require array based storage cleanup, remove files from the datastore or add more physical storage to the datastore before a deletion, remove or consolidation can be performed.
cd /vmfs/volumes/datastore/vm/
vim-cmd vmsvc/getallvms |grep VM_name
vim-cmd vimsvc/task_list vmid
ManagedObjectReference) [
'vim.Task:haTask-xxxxxx-vim.vm.Snapshot.remove-xxxxxxx'
]
vim-cmd vimsvc/task_info haTask-xxx-vim.vm.Snapshot.remove-xxxxxxx
(vim.TaskInfo) {
dynamicType = <unset>,
key = "haTask-31-vim.vm.Snapshot.remove-xxxxxxx",
task = 'vim.Task:haTask-31-vim.vm.Snapshot.remove-xxxxxxx',
description = (vmodl.LocalizableMessage) null,
name = "vim.vm.Snapshot.remove",
descriptionId = "vm.Snapshot.remove",
entity = 'vim.VirtualMachine:31',
entityName = "VM_name",
state = "running",
cancelled = false,
cancelable = true,
error = (vmodl.MethodFault) null,
result = <unset>,
progress = 99,
reason = (vim.TaskReasonUser) {
dynamicType = <unset>,
userName = "vpxuser",
},
queueTime = "2016-12-30T14:23:32.79546Z",
startTime = "2016-12-30T14:23:32.795704Z",
completeTime = <unset>,
eventChainId = xxxxxxx,
changeTag = <unset>,
parentTaskKey = <unset>,
rootTaskKey = <unset>,
The datastore is reported as a file path to the VM_name.vmdk (Example: [datastore_name] VM_directory/VM_name.vmdk)
Impact/Risks: