Wednesday, 16 December 2015

Unable To Take A Snapshot Of A VM - An error occurred while taking a snapshot: Change tracking target file already exists.



Written by Suhas Savkoor



You had a virtual machine which was scheduled for a backup task. The backup job completed and now you want to perform a manual snapshot operation for this virtual machine.

When you take a manual snapshot of this VM, it fails! With the following error;

An error occurred while taking a snapshot: Change tracking target file already exists.
An error occurred while saving the snapshot: Change tracking target file already exists.

There are no snapshots in the snapshot manager. The virtual machine disks are running on the base disk and not a snapshot disk. 

However, when you browse the datastore for this virtual machine, you notice certain ctk.vmdk files. There will be N number of ctk.vmdk for N number of VMDKs. 

A VMware CTK file contains a list of all the changes made to a VMware virtual machine (VM) since it was last backed up. 
CTK change tracking files exist on all VMs where VMware's Changed Block Tracking (CBT) technology is enabled. CBT relies on the CTK file's information to back up only the VM information blocks that have changed, instead of backing up the entire VM. 

There is only one CTK file in the virtual machine disk files, and it has the file extension .ctk. The CTK file is always much smaller than VMware Virtual Machine Disk File (VMDK) block it describes.

What needs to be done?

1. Either browse the datastore for the virtual machine folder from the GUI or open a SSH/Command Line to the host where this virtual machine resides.

2. Delete the ctk.vmdk files

3. Perform the snapshot operation. 

Success!