Checking the Status of a vSphere Consolidation via CLI

January 18, 2021 Jordansphere VMware

Issue:

To check the status of a snapshot consildation you can use two methods to confirm its progress and whether its still running:

 

Solution

Interactively check the filestamps on the vmdk files:

SSH to ESXI host and CD into the directory of the VM

watch -d 'ls -luth | grep -E "delta|flat|sesparse"'

Output

Every 2s: ls -luth | grep -E "delta|flat|sesparse"                                                          2021-01-18 09:07:05

-rw-------    1 root     root      185.1G Jan 18 09:06 VMNAME_2-000025-sesparse.vmdk
-rw-------    1 root     root      165.9G Jan 18 08:51 VMNAME_2-000024-sesparse.vmdk
-rw-------    1 root     root      167.2G Jan 18 06:02 VMNAME_2-000023-sesparse.vmdk
-rw-------    1 root     root      173.4G Jan 18 03:07 VMNAME_2-000022-sesparse.vmdk
-rw-------    1 root     root      161.5G Jan 18 00:08 VMNAME_2-000021-sesparse.vmdk
-rw-------    1 root     root      184.2G Jan 17 21:14 VMNAME_2-000020-sesparse.vmdk
-rw-------    1 root     root      177.3G Jan 17 18:06 VMNAME_2-000019-sesparse.vmdk
-rw-------    1 root     root      179.4G Jan 17 15:11 VMNAME_2-000018-sesparse.vmdk
-rw-------    1 root     root      180.6G Jan 17 12:16 VMNAME_2-000017-sesparse.vmdk
-rw-------    1 root     root      176.9G Jan 17 09:15 VMNAME_2-000016-sesparse.vmdk
-rw-------    1 root     root      161.0G Jan 17 06:18 VMNAME_2-000015-sesparse.vmdk
-rw-------    1 root     root      141.5G Jan 17 03:23 VMNAME_2-000014-sesparse.vmdk
-rw-------    1 root     root      229.2G Jan 16 23:55 VMNAME_2-000013-sesparse.vmdk
-rw-------    1 root     root       50.3G Jan 16 19:43 VMNAME_2-000012-sesparse.vmdk
-rw-------    1 root     root      175.3G Jan 16 19:00 VMNAME_2-000011-sesparse.vmdk
-rw-------    1 root     root      160.4G Jan 16 15:53 VMNAME_2-000010-sesparse.vmdk
-rw-------    1 root     root      147.1G Jan 16 13:10 VMNAME_2-000009-sesparse.vmdk
-rw-------    1 root     root      198.3G Jan 16 10:39 VMNAME_2-000008-sesparse.vmdk
-rw-------    1 root     root       27.8G Jan 16 07:12 VMNAME_2-000007-sesparse.vmdk
-rw-------    1 root     root      148.9G Jan 16 06:46 VMNAME_2-000006-sesparse.vmdk
-rw-------    1 root     root      243.2G Jan 16 04:16 VMNAME_2-000005-sesparse.vmdk
-rw-------    1 root     root       31.0G Jan 15 22:25 VMNAME_2-000004-sesparse.vmdk
-rw-------    1 root     root      185.1G Jan 15 21:53 VMNAME_2-000003-sesparse.vmdk
-rw-------    1 root     root      239.6G Jan 15 18:47 VMNAME_2-000002-sesparse.vmdk
-rw-------    1 root     root       37.8G Jan 15 14:25 VMNAME_2-000001-sesparse.vmdk
-rw-------    1 root     root      253.8G Jan 15 13:48 VMNAME_2-000026-sesparse.vmdk
-rw-------    1 root     root       20.0G Jan 15 09:38 VMNAME-flat.vmdk
-rw-------    1 root     root        1.3T Dec 19 18:50 VMNAME_2-flat.vmdk

 

As you'll see the top file has been touched in the last minute

 

To delve further and show the status of the task use the following commands:

vim-cmd vimsvc/task_list | grep con

Output

'vim.Task:haTask-15-vim.VirtualMachine.consolidateDisks-168704495'

 

 

 

Use the taskId to show more flags

vim-cmd vimsvc/task_info haTask-15-vim.VirtualMachine.consolidateDisks-168704495

 

(vim.TaskInfo) {
   key = "haTask-15-vim.VirtualMachine.consolidateDisks-168704495",
   task = 'vim.Task:haTask-15-vim.VirtualMachine.consolidateDisks-168704495',
   description = (vmodl.LocalizableMessage) null,
   name = "vim.VirtualMachine.consolidateDisks",
   descriptionId = "VirtualMachine.consolidateDisks",
   entity = 'vim.VirtualMachine:15',
   entityName = "VMNAME",
   locked = <unset>,
   state = "running",
   cancelled = false,
   cancelable = true,
   error = (vmodl.MethodFault) null,
   result = <unset>,
   progress = 93,
   reason = (vim.TaskReasonUser) {
      userName = "vpxuser"
   },
   queueTime = "2021-01-15T13:47:57.339075Z",
   startTime = "2021-01-15T13:47:57.339263Z",
   completeTime = <unset>,
   eventChainId = 168704495,
   changeTag = <unset>,
   parentTaskKey = <unset>,
   rootTaskKey = <unset>,
   activationId = <unset>
}

As you can see the progress is at 93% and the status is showing as running

Powered by WordPress. Designed by elogi.