Posted by: Eric Siebert
Eric Siebert, ESX, Snapshots, VMware
A recent KnowledgeBase article from VMware describes a method to monitor the snapshot deletion process which can take a long time if the snapshot has been active for a while.
When you delete snapshots using the VMware Infrastructure Client, the taskbar that displays the deletion progress immediately jumps to 95% and stays at 95% the snapshot is entirely deleted. The taskbar does not show any progress while the delta files are being merged back into the original .vmdk file. Additionally, vCenter Server has a default 15 minute task timeout, so if the snapshot deletion task takes longer then 15 minutes it will timeout in vCenter Server even though it is still running on the host server.
The method in the KnowledgeBase article uses an ESX service console command to perform a directory listing on .vmdk files, so you can see their modified times changing and that the delta.vmdk files disappear after the snapshots are deleted. Here is the command from the knowledgebase article:
watch "ls -lhut --time-style=full-iso *.vmdk"
The way the syntax is currently published, however, is incorrect. Is it missing the double-dash before the time-style option; hopefully VMware will correct this soon.
Let’s go over what the command does. The watch command runs a command repeatedly and displays its output every 2 seconds. The command that watch is running in the previous sequence is the ls command, which lists file information in the directory. The options used with the ls command are –lhut, which are individual options that are all grouped together and are listed below:
• -l – use long listing format which displays more information
• -h – display file sizes in human-readable form (i.e. GB instead of bytes)
• -u – when used with –lt sorts and shows files by access time
• -t – sorts by modification time
Additionally the -–time-style option set to full-iso shows the modified time in longer form with seconds, and the final *.vmdk option tells the ls command to only display .vmdk virtual disk files.
While this command works I modified it a bit to drop the group/owner information (-og instead of –l) from being displayed, so the results fits better on the screen. I also tweaked it to use the shorter –-fulltime parameter instead.
watch “ls –oghut –-full-time *.vmdk”
To use the command, log in to the VMware service console, go to your VM’s directory where the snapshot files are located, and run the command. A listing of the files will be displayed along with size and modification information as shown below:
Once you see the –delta.vmdk files disappear you will know that the snapshot has been deleted, as shown below:
To stop the command from running just press ‘.’ While you will probably not use this method when deleting smaller snapshots, it is useful for larger ones that can take quite a while to delete.