CBT on Virtual Machines

IRAKOZE Yves
5 min readNov 29, 2021

CBT (Changed Block Tracking) is a feature that recognizes data blocks that have changed or are currently in use. It allows incremental backups to detect changes since the last backup and write only altered or in-use blocks.

What Is VMware Changed Block Tracking and How It Works

For more information please follow this link: https://www.nakivo.com/blog/vmware-changed-block-tracking-works/

You may notice the following symptoms when backing up a virtual machine:

  • The backup of the virtual machine fails. You see this error similar to:

One or more VM disks have incorrect changed block tracking configuration

  • The backup job show errors similar to:

Disk “Hard disk #” has incorrect changed block tracking configuration.
One or more VM disks have incorrect changed block tracking configuration.

This article discusses Changed Block Tracking (CBT) and the alarms that might occur while backing up a virtual system using this capability.

CBT (Changed Block Tracking) is a VMkernel feature that maintains track of virtual machine storage blocks as they change over time. The VMkernel maintains track of block changes on virtual machines, which helps with backups for apps that use VMware’s vStorage APIs.

  • The VMware API calls are used by the backup appliance to request that a snapshot be made. The snapshot is then taken by VMware and shown to the user so that a backup may be created.
  • CBT (Changed Block Tracking) is a feature that recognizes data blocks that have changed or are currently in use. It allows incremental backups to detect changes from the previous backup and only write altered or in-use blocks.

Virtual machines operating on ESXi hosts can keep track of altered disk sectors. Changed Block Tracking is the name of this functionality (CBT).

CBT detects the disk sectors that have changed between two changeset IDs on several file systems. CBT can also detect all the disk sectors that are in use on VMFS volumes.

If CBT is off or not working properly, an incremental backup may back up the entire virtual machine disk rather than only modified blocks, or a full backup may be required.

In the virtualization layer, changes to virtual disk blocks are tracked from outside virtual machines. When software conducts a backup, it has the option of requesting just the blocks that have changed since the last backup, or only the blocks that are currently in use.

Third-party backup programs can use the vSphere APIs to access the CBT capability. Applications use VAPI to ask the VMkernel to return blocks of data on a virtual disk that have changed since the last backup snapshot.

These elements are necessary for CBT to recognize changed disk sectors since the previous change ID:

  • The host must be ESXi 4.0 or later.
  • The virtual machine owning the disks to be tracked must be hardware version 7 or later.
  • I/O operations must go through the ESXi storage stack. NFS is supported, RDM in virtual compatibility mode, VMFS is supported, whether backed by SAN, iSCSI, or local disk.
  • CBT must be enabled for the virtual machine (see below & by default, it is enabled).
  • Virtual machine storage must not be (persistent or non-persistent) independent disk, meaning unaffected by snapshots.

Note: RDM in physical compatibility mode is not supported

These elements are necessary for CBT to detect disk sectors in use with the special “*” change ID:
- The virtual disk must be on a VMFS volume with SAN, iSCSI, or local disk as a backup.
- When CBT is enabled, the virtual machine must have zero (0) snapshots for a clean start.
CBT may reset and lose track of incremental changes in some instances, such as when there is a power outage or a hard shutdown when virtual machines are switched on.

Note: Before activating Changed Block Tracking, make sure there are no snapshots on the virtual system. If you make snapshots before turning on CBT, the QueryChangedDiskAreas API may not return any errors, or the data supplied by QueryChangedDiskAreas may be erroneous.

To check if a virtual disk has CBT enabled:
1. Open the vSphere Client and select a powered-off virtual machine.
2. Right-click the virtual machine and navigate to Edit Settings > Options > Advanced/General > Configuration Parameters.

3. The virtual machine’s configuration file (.vmx) contains the following entry:

ctkEnabled = “TRUE”

4. The.vmx file for each virtual disk has the following entry:

scsix:x.ctkEnabled = “TRUE”

Note: scsi0:0 in scsi0:0.ctkEnabled The SCSI device attached to the virtual machine’s hard drive is indicated by ctkEnabled. Every virtual machine hard disk is assigned a SCSI device that looks like scsi0:0, scsi0:1, or scsi 1:1. On each drive, CBT is separately activated (or disabled).

5. a.ctk file exists for each virtual disk and snapshot disk.

For example:
vmname.vmdk
vmname-flat.vmdk
vmname-ctk.vmdk
vmname-000001.vmdk
vmname-000001-delta.vmdk
vmname-000001-ctk.vmdk

6. Power on the virtual machine.

7. In the home directory of the virtual machine, verify that each disk having CBT enabled has
also a vmname-ctk.vmdk file.
Note: After a successful backup and full snapshot consolidation, there should be no snapshot-related .ctk files remaining in the datastore. For example: vmname-000001-ctk.vmdk.

To disable CBT, make sure the virtual machine has no snapshots. More information may be found at:

  • Consolidating/Committing snapshots in VMware ESXi (1002310)
  • “A specified parameter was not correct: vm.ctkEnabled” error when cloning a virtual machine (76280)

To disable CBT:
1. Power off the virtual machine.
2. Right-click the virtual machine and click Edit Settings.
3. Click the Options tab.
4. Click General under the Advanced section and then click Configuration Parameters. The Configuration Parameters dialog opens.
5. Set the ctkEnabled parameter to false for the desired SCSI disk(s).
6. Power on the virtual machine.

See the section Changed Block Tracking on Virtual Disks in the Designing vSphere Backup Solutions part of the manual for further details.

--

--