I’ve built and actively manage a number of VMware ESX servers and server clusters, and one of the things that bug me is that as soon as I delete a snapshot I have no idea on its progress (especially if it’s a large snapshot, which can take quite a while).
Here’s a quick tip to keep an eye on the snapshot deletion: Once you’ve given the command to delete a snapshot, go to the CLI (i.e.: log in to the ESX server that the VM is on), then cd to the directory where the VM is located:
cd /vmfs/volumes/DatastoreName/VMname
Once in the directory use the command:
file *
This will give you an extended list of the files in that directory. The files that the snapshot process is working on will be listed as ‘can’t read ‘diskfilename.vmdk’ (Device or resource busy)‘. Now you can check that these are both the snapshots and the main disks that the snapshot data is to be committed to. To see if the process is actually writing to the target disk file, just ls it every so often and keen an eye on the date and time, it should update to indicate that the disk image is being written to.
A short example: Say the VM is called ‘VMSERVER01′ and it’s on a datastore called ‘SANvolume1′. You use the Snapshot Manager in the VI Client to delete a snapshot, then SSH to the ESX server.
cd /vmfs/volumes/SANvolume1/VMSERVER01
file *
The result would look something like this:
VMSERVER01-flat.vmdk: can't read 'VMSERVER01-flat.vmdk' (Device or resource busy).
VMSERVER01.vmdk: ASCII English text
VMSERVER01-d1e733fe.hlog: ASCII text
VMSERVER01-d1e733fe.vswp: empty
VMSERVER01-000001-delta.vmdk: can't read 'VMSERVER01-000001-delta.vmdk' (Device or resource busy).
VMSERVER01-000001.vmdk: ASCII English text
VMSERVER01.nvram: VMware nvram
VMSERVER01.vmsd: ASCII text
VMSERVER01.vmx: a /usr/bin/vmware script text executable
VMSERVER01.vmxf: XML document text
vmware.log: ASCII C++ program text, with very long lines
This shows you that the server is busy committing the data from the snapshot file (VMSERVER01-000001-delta.vmdk) to the main disk file (VMSERVER01-flat.vmdk). Now you know which disk file should be the one being written to so you can just use ls every once in a while, while the server is still busily chewing on the snapshot, to see the time on the main disk file change to confirm that is is still being written to:
ls -l VMSERVER01-flat.vmdk
Every once in a while also run the file command again to se whether or not the snapshot files have disappeared, confirming that the snapshot has indeed been deleted.
Hope this helps, it did for me
