Deleting a snapshot can sometimes go wrong. Through vSphere client you can't see any progress and it's impossible to visualize the status of snapshot deletion. Today's post, ESXi Commands List – Snapshot Deletion Monitoring, will show some ESXi CLI commands which should help.
Snapshots are something which has been around since the beginning of virtualization. While it's cool to go back in time and restore your system to previous state, cumulating snapshots within a production environment is not good practice. Snapshots should be used sparingly and only temporary. Snapshots are not backups either.
Other ESXi Commands:
Let's get back to snapshots. When working with snapshots you may experience a situation where you can't see any progress through vSphere client. In order to monitor the progress of a snapshot, we need to know the contents of a directory where the VM is stored, or rather where its particular VMDK disk is located. The contents of this directory changes when you launch snapshot deletion.
So you launch putty session and navigate to the directory via:
and list the directory content via:
Then start to look for any files with “-delta.vmdk” which are the snapshot files. If you're running vSphere 5.5, You might see also files with -sesparse.vmdk (files larger than 2TB).
The Snapshot deletion monitoring command is:
watch -d ‘ls -luth | grep -E “delta|flat|sesparse”‘
- d is the differences between successive updates
- t will sorts by modification time
- l shows a long listing which displays additional file information
- u sorts by and shows access time
- h prints sizes in a readable format such as 1K 234M 2G
In order to see some progress (or not) when you're working with large snapshots, you can monitor the time stamp. The command gets you back the content of the directory and displays files by their modification date:
ls -lrth |grep -E “flat|delta|sesparse”
How do I stop command when it's already launched?
Simple. Just do:
Ctrl + c
Now, if in any case you have VM with lots of snapshots, it's also possible to monitor the snapshot commit process and at the same time to avoid having the screen filled with too many files:
while true;do date;ls -lht *vmdk|head -10;echo ________;sleep 3;done
And at the end a quick quote from one VMware KB which teaches best practices for snapshots…
Snapshots are not complete copies of the original vmdk disk files. Taking a snapshot does not create a complete copy of the original vmdk disk file, rather it only copies the delta disks. The change log in the snapshot file combines with the original disk files to make up the current state of the virtual machine. If the base disks are deleted, the snapshot files are useless.
- VMware KB1007566
- Understanding virtual machine snapshots in VMware ESXi and ESX
- Best practices for virtual machine snapshots in the VMware environment
- How to Install latest ESXi VMware Patch
- Install ESXi 6 to USB as Destination or Have it as Source (USB installer)
- ESXi 6.0 Downgrade Options – Lab Time [Guide]
More ESXi CLI commands:
- ESXi CLI Networking commands
- ESXi Commands List – Getting Started
- ESXi Commands List – Snapshot Deletion Monitoring – (This Post)
- ESXi Commands List – Storage