Changed Block Tracking

Anybody who has ever worked on developing VM backup and restore or the Replication features, will tell you that it’s a chore to have to figure out the changed blocks on our own. Well, you guessed it right, VMware took a note of it. And as part of the efforts to simplify and improve the efficiency of backup processes for VMware virtual machines, they introduced a feature called Changed Block Tracking in the VMware ESX/ESXi 4.0 onwards.

So, what exactly is Changed Block Tracking, or CBT as it is abbreviated.

Quite literally, Change Block Tracking (CBT) keeps track of the storage blocks of virtual machines as they change over time. Virtual machines running on ESX/ESXi hosts can track disk sectors that have changed. On many file systems, CBT identifies the disk sectors altered between two change set IDs. On VMFS partitions, CBT can also identify all the disk sectors that are in use.

Before getting into more details of CBT, let’s first understand how traditional VM Backup/Restore worked. Before CBT, VM backups required an agent on every VM. And although the backups/restores work just fine, the implementation itself has a few issues of its own. Each agent consumes physical server resources when performing a backup or scan. One agent on one server is not a problem. Dozens of agents on dozens of virtual servers will reduce the number of VMs that can be supported on that physical server.

Another problem with traditional VM backups was that backup softwares generally work, among other goals, towards taking maximum number of backups in the shortest time period. Backup time windows in large organizations are pricey and are shrinking day by day.

So, CBT proved to be a boon for the developers of third party backup applications. It enabled them to get the list of only the blocks that changed since the last backup. The VMkernel keeps track of block changes on virtual machines. As a developer you no longer need to worry about writing code that first finds what blocks have changed. Instead you can write code to ask the VMkernel for that information. Much less effort on your part! It works by using VMware’s APIs to send queries to the VMkernel, which in turn, produce the information about the latest data since the last backup function.

It also meant that they didn’t require copying out data that had been copied previously. The amount of data copied out reduced by more than 99%, which saves a lot of time in the backup process. Add to this all the additional data reduction technologies that are applied like dedupe, compression, et al and we have a very efficient VM backup and recovery software.

So, how exactly does the CBT feature work?

Virtual disk block changes are tracked from outside virtual machines, in the virtualization layer. If CBT is enabled for a virtual disk the VMkernel will create an additional file (named …-ctk.vmdk) in the same directory where it stores a map of all the virtual disk’s blocks. Once a block is changed it will be recorded in this map file. This way the VMkernel can easily tell a backup application what blocks of a file have changed since a certain point in time. The application can then perform an incremental backup by saving only these changed blocks. When software performs a backup, it can request transmission of only the blocks that changed since the last backup, or the blocks in use. The CBT feature can be accessed by third-party applications as part of the vSphere APIs for Data Protection (VADP). Applications call VADP to request that the VMkernel return blocks of data that have changed on a virtual disk since the last backup snapshot.

Requirements:

  • The host must be ESX/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 ESX/ESXi storage stack
  • CBT must be enabled for the virtual machine (We will see how to do it in a while).
  • No independent disk because they are unaffected by snapshots.

How do we enable CBT?

A configuration parameter for a VM named ctk.Enabled should be added and be set to “true”. In addition to this, set scsix:x.ctkEnabled = “TRUE” where x.x marks all the disks for which CBT is to be enabled.

After enabling CBT, it is required to perform a stun-unstun cycle on the VM by restarting it or by suspending and resuming it.

Many backup restore applications in the market have already taken advantage of this feature to greatly enhance their backup speeds and efficiency. There are a number of articles explaining CBT in more detail which you can find in the references section below.

  1. ITknowledgeExchange:

    http://itknowledgeexchange.techtarget.com/virtualization-pro/what-is-changed-block-tracking-in-vsphere/

  2. VMware KB:

    http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1020128

2 Responses to “Changed Block Tracking”

  1. moncler dupres November 26, 2013 at 12:42 pm

    I am extremely impressed with your writing skills and also with the layout on your blog. Is this a paid theme or did you modify it yourself? Anyway keep up the excellent quality writing, it is rare to see a nice blog like this one these days..
    moncler dupres http://www.mspcorreo.com/%E3%82%AD%E3%83%83%E3%82%BA-c-14.html

  2. tree grate December 19, 2013 at 11:13 pm

    Hello my friend! I wish to say that this article is awesome, nice written and come with approximately all vital infos. I would like to peer extra posts like this.

Leave a Reply