April 24, 2017
What is VMware Changed Block Tracking and How It Works
When thinking about modern VMware backup solutions, most leverage a technology called Changed Block Tracking or CBT to facilitate taking incremental backups of virtual machines. This technology is derived from the VMware Data Protection API which allows third-party backup applications to take advantage of CBT to perform backups. The advantage of VMware CBT is that it significantly reduces the amount of time the backup software takes to perform incremental backups because it tracks changes in a special Changed Block Tracking log file. VMware Changed Block Tracking not only benefits incremental backups but also all related activities such as replication. Changed Block Tracking is also used by VMware’s Storage vMotion process that allows virtual machine disk files to be moved from one datastore to another while it is running. Let’s take a closer look at how Changed Block Tracking works, requirements for CBT, how to enable it, and how it relates to third-party backup utilities.
How VMware Changed Block Tracking Works?
Changed Block Tracking technology actually keeps up with the blocks of a virtual machine disk that have changed since a certain point in time like a checkpoint. There are obvious advantages when thinking about changed block tracking when it comes to backup operations as mentioned earlier. So, let’s see how CBT technology works.
VMware CBT technology is a part of the VMkernel storage stack that is available for third party applications to query via the vStorage APIs for Data protection. Changed Block Tracking is a VMFS filter. Requirements for Changed Block Tracking include:
- Version 7 virtual hardware or higher
- NFS or iSCSI datastores
- Thick or thin provisioning
- No RAW disk mappings
What are the "blocks" that are recorded that are changed? Changed Blocks are recorded at a VMDK level and not a VMFS level and the variable block sizes are dictated by the size of the VMDK represented.
Changed Block Tracking is enabled in a virtual machine's advanced configuration parameters. This can be added by navigating to the Advanced/General > Configuration Parameters configuration of the virtual machine. CBT activation is determined by the line ctkEnabled = "True" line in the VMX configuration. Also, for each disk that CBT is enabled, an entry will be included:
- scsix:x.ctkEnabled = "TRUE"
Once CBT is enabled on a virtual machine, the VMkernel creates an additional file with "-ctk.vmdk" in the virtual machine directory that is used to store the mapping of virtual disk blocks. Inside this "ctk" file are sequence numbers that can tell if the blocks for a specific virtual machine disk have changed. The size of the "ctk" file that gets created stays the same and does not grow beyond the original size unless the size of the virtual disk is increased. The size of the "ctk" file is approximately .5MB for every 10GB of the virtual machine disk size.
Most backup solutions will use the VMware SDK method to programmatically enable CBT for a virtual machine and use a stun/unstun cycle which includes either power on or off, suspend/resume, or create/delete a snapshot. During a stun/unstun cycle a special change tracking filter is inserted into the VMware storage stack for the particular VM which allows changed block tracking to instantiate on the virtual machine.
VMware Changed Block Tracking is an integral part of modern backup solutions providing efficient backups of today’s production VMware environments. The built-in VMware APIs allow for hooks into this technology to be utilized for both backup and replication processes. The technology is well tested and heavily utilized not only in backup solutions but also in tried and true VMware technology such as Storage vMotion.