Orphaned Snapshots in VMWare

Considering that the snapshot are not listed in VMWare snapshot manager and presuming that already we’ve tried to create a new snapshot ant then delete all and nothing is happening, in order to remove the orphaned snapshots we need:

  • First step is to find all snapshots and delta disks on the datastores: from SSH on the host
    find /vmfs/volumes/ -name *-delta*;find /vmfs/volumes/ -name *-0000*

    (if you know the VM this is not required)

  • This will list the vmdk’s which  are mounted by VMX file for the affected VM
     cat /vmfs/volumes/[id]/[VM]/VM.vmx | grep vmdk

    (this should be checked also because we don’t know if all disks which resides in the VM folder are used)

  • If you use cat on this vmdk files you should see what underlying file on the datastore they reference under  Extent Description and  Change tracking file
    cat VM_X.vmdk

    Then you should check if the vmkd file are locked by any hosts –delta , -ctk and –flat

    vmkfstools -D VM-000002-delta.vmdk

    (If it was locked by an ESXi host the MAC of the host would be shown in the owner)

  • Then make sure they are not locked by a process, touch them and see that the timestamp updates:
    touch /vmfs/volumes/[id]/[VM]/*-00000* | ls -ltr | grep vmdk

    Being able to touch the file, run vmkfstools -D finding no locks, find no references in vmdk descriptor files generally means it isn’t in active use and is safe to move/remove. (Please be aware this command should be used from other host, not from the one where VM resides )

  • Create a new directory and move the suspect files to it and check for problems with the VM
mkdir toberemoved 
mv *-00000* toberemoved/.
  • Check the VM state and if it is operating normally delete the directory
rm –r toberemoved/

 

Leave a Reply

Your email address will not be published. Required fields are marked *