Monday, January 10, 2011

Checking consistency of VMware snapshot chain

Scenario/Issue: Customer has many may snapshots on a virtual machine or your are getting errors related to snapshots. Snapshot manager GUI [graphical user interface] may show/report no snapshots but the command line shows that it has snapshots
Determine if the virtual machine has snapshots:
# [KB Article: 1006847]
vmware-cmd /vmfs/volumes/volume-UUID-or-name/vm1/vm1.vmx hassnapshot
The output will look like one of the following:
hassnapshot() =
or
hassnapshot() = 1
If the result is not equal to one (1), there are no snapshots for the virtual machine and there is no reason to proceed further.
Sometimes the CLI may also tell you that it has no snapshots but the folder containing the VM files has many delta files and you want to be sure that you do not miss out on any data.
Resolution:
The regular boring and usual way is to take the highest number of snapshot and run the command
cat -delta.vmdk and check the PID and CID and check the chain
or use the following
Please try this command to test the entire snapshot chain .. This will display any errors related to snapshot ..
Vmkfstools –t0 –v10 lastsnapshot-00000n.vmdk - This command has to be issued for each hdd of the virtual machine when you have more than one hdd per VM.
or

vmkfstools -q -v10 "your_disk.vmdk"
Try this command to display the CID , PID & parent file names for all the snapshots of a VM..
Change directory to the VM, then issue this command .
Find . –name \*.vmdk –size -10k | xargs egrep - i “CID|PID” | sort - n
------------------i claim no copyright on any of the content here. sharing is caring.