What is VMware Changed Block Tracking
Most of today’s backup solutions that interact with VMware vSphere environments are able to use a technology called Changed Block Tracking (CBT) which allows taking incremental backups of virtual machines much more efficient which allows much smaller and quicker backups on each iteration of a backup cycle. Most likely you have heard of the technology with your backup solution or in reading VMware documentation. What is VMware Changed Block Tracking and how is it implemented? How do backup solutions take advantage of this builtin technology?
What is VMware Changed Block Tracking?
VMware Changed Block Tracking (CBT) comes from the VMware Data Protection API which was released in vSphere 4.0 that allows applications such as third-party backup solutions to take advantage of the CBT hooks to perform backups. Changed Block Tracking is also an integral part of the Storage vMotion feature that allows hot moving virtual machine disk files between VMFS datastores.
After a full backup of the virtual machine, each incremental backup only copies the blocks that have changed from the last backup iteration. We can imagine the efficiency impact this has not only on backups but also replication jobs that are able to utilize CBT for backups.
How VMware Changed Block Tracking Works
How exactly does Changed Block Tracking work in VMware vSphere? As mentioned above, CBT keeps a record of the blocks used by a virtual machine and tracks the blocks that change between each backup interval. CBT is a VMFS filter driver that has a few requirements for implementation:
- VMware vSphere 4.0 and higher
- VMware Virtual Machine hardware version 7
- I/O operations must traverse the ESX/ESXi storage stack
- RDM in virtual compatibility mode is supported, however, RDM in physical compatibility mode is not supported.
- Disks can be thick provisioned or thin provisioned
- Independent disks (not supported by snapshots) are not supported for CBT
Below we can check the virtual machine hardware version by clickingย Edit Settings in the flash client and looking at theย Virtual Hardwareย tab.
We may think about the “blocks” in the Changed Block Tracking feature as a VMFS level feature, however the blocks recorded are at the VMDK level and implemented as such as we will see in the screenshots of the virtual machine files on the datastore.
Viewing VMware Changed Block Tracking Settings
To view the changed block tracking settings on a VMware virtual machine, we need to look at the advanced configuration settings of the virtual machine. we can get to the advanced configuration settings by Right-clicking on the virtual machine >> Edit Settings >> VM Options >> Advanced >> Edit Configuration.ย The value for theย ctkEnabled flag will be set toย TRUE.
Most modern backup solutions will enable Changed Block Tracking automatically during a stun/unstun cycle initiated by a create/delete snapshot. This can be controlled in a manual way by editing the ctkEnabled value in the Configuration parameters of the virtual machine as shown above. Once the value is set to true, each disk that has CBT enabled will have the entry for ctkEnabled set to true as well as shown in the screenshots below.
If we browse the VMFS datastore where the virtual machine resides, we can see that we have a “ctk.vmdk” file for each VMDK that has CBT enabled.ย The CTK file contains change tracking information of the corresponding VMDK file.ย Within the CTK, there is a USN sequence number for each block in the corresponding VMDK.ย When a backup solution asks the VMware storage API what blocks have changed since a moment in time, the API can reference the CTK and compare the sequence number in the file versus the actual USN sequence number on each block.ย If the USN number is smaller in the CTK than the USN contained on the actual block, the block has been changed and the backup solution knows it needs to be backed up or replicated if replication is involved.
The CTK file size is approximated
Thoughts
To summarize What is VMware Changed Block Tracking?ย It is a mechanism to allow very efficient backups as well as replication tasks performed by backup solutions that allow for only the blocks that have changed to be included in a backup or replication iteration.ย This is vastly more efficient than performing a full backup of a virtual machine each time a backup or replication cycle kicks off.ย Interestingly, CBT is also used during a Storage vMotion of a virtual machine between datastores.