VMware

What is VMware Changed Block Tracking

A look at an important part VMware vSphere virtual machines that allows for efficient backups and replication. 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.

Checking-VMware-virtual-machine-hardware-version-for-CBT-compatibility
Checking VMware virtual machine hardware version for CBT compatibility

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.

Checking-the-ctkEnabled-flag-on-a-virtual-machine
Checking the ctkEnabled flag on a virtual machine

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.

Checking-to-see-if-CBT-is-enabled-on-a-VMDK
Checking to see if CBT is enabled on a VMDK

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

Browsing-the-datastore-we-can-see-the-CTK-file-for-each-VMDK
Browsing the datastore we can see the CTK file for each VMDK

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.

Subscribe to VirtualizationHowto via Email 🔔

Enter your email address to subscribe to this blog and receive notifications of new posts by email.



Brandon Lee

Brandon Lee is the Senior Writer, Engineer and owner at Virtualizationhowto.com, and a 7-time VMware vExpert, with over two decades of experience in Information Technology. Having worked for numerous Fortune 500 companies as well as in various industries, He has extensive experience in various IT segments and is a strong advocate for open source technologies. Brandon holds many industry certifications, loves the outdoors and spending time with family. Also, he goes through the effort of testing and troubleshooting issues, so you don't have to.

Related Articles

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.