How to check if a snapshot is an orphan ?
Platform : ESX , Workstation , Fusion
Orphaned snapshots are snapshots that are not part of any existing snapshot-chain.
This should never happen - but in some cases ....
- unwise user action some time ago
- Workstation or ESX crash
- host OS crash or power-failure
- running out of diskspace during a snapshot action
- misconfigured or buggy behaviour of VMware tools like VCB or VDR
- misconfigured or buggy behaviour of third party backup tools - especially for ESX and ESXi
It is not trivial to check if a snapshot is orphaned for several reasons
- looking at the snapshot number in the filename is unreliable
- looking at the vmsd file is unreliable
- looking at the filename hint in the vmx-file only references the last used one at the end of the chain
- a snapshot maybe used by a VM in a different directory
- a snapshot maybe part of a linked clone in a different directory
- a snapshot may be the only part of a a separete branch in the snapshot-tree
To be absolutely sure if this snapshot is orphaned and so can be deleted we have to check if it is referenced
by any of the other vmdk-descriptions found in the same directory.
In case any other vmdk references the snapshot it may be part of one branch of the tree.
In case the snapshot is a direct child of the basedisk it may be a valid separate branch all by itself.
In case the CID or parentCID of the snapshot are referenced by any other vmdk it may be a required snapshot even if the parentfile name hints don't match.
What is the size of the snapshot file ?
The larger it is the longer it has been in use - the more valuable data may be stored in it.
Even If it is very small it may have never been used but it also may contain a single file - maybe just THE important one.
Long story short: you have to make an educated guess after analysing the other vmdks in the same directory.
Automated scripts that check for orphaned snapshots are only trustworthy if you can rule out user-mistakes.