Enabling Change Block Tracking (CBT) on a Virtual Machine (VMware vSphere 5.1)

2013/01/22 | 2 minute read |

Update: 2013/07/02 I wrote another post about CBT and create a re-usable PowerShell function

I recently had to enable CBT in my VMware vSphere environment, on a good amount of Virtual Machines.

What is Change Block Tracking (CBT) ? If you are not familiar with CBT, checkout the following articles:

How to implement CBT, what do you need ?

  • VM version 7 at least,

  • No snapshot on your VM

  • Enable CBT,

  • Finally the VM must go through a stun-unstun cycle(power on, resume after suspend, migrate, or snapshot create/delete/revert) before the reconfiguration takes effect.

How to Enable CBT on your VM ? (GUI)</b>

Note: When the VM is Powered ON you won't be able to access those settings. However, It is possible to do it via PowerShell even when the VM is started. :-) (see below)

Navigate to Configuration Parameters and add the following Entries.

Right click on your VM, select Edit Settings/Options Tab/Advanced/General. Click on Configuration Parameters and add the following entries
This enable CBT on your VM. ctkEnabled = true
Additionally, you need to add an entry for each disk. (in this example I had two virtual disks) scsi0:0.ctkEnabled = true scsi0:1.ctkEnabled= true

How to Enable CBT on your VM ? (PowerShell/PowerCli)</b>

You can do the following even if your VM is Powered ON.

# Check and Add the PowerCli Snaping if not already present
if(-not(Get-PSSnapin -Registered -Name "VMware.VimAutomation.Core"){
    Add-PSSnapin -Name VMware.VimAutomation.Core}

# Connect to my Vcenter
Connect-VIServer -Server vcenter.fx.lab

#Here is aRunning the script on TESTSERVER04 to enable CBT
$vmtest = Get-vm TESTSERVER04 | get-view
$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec
$vmConfigSpec.changeTrackingEnabled = $true
$vmtest.reconfigVM($vmConfigSpec)

How to Apply this CBT configuration ?

Once you enable CBT, the VM must go through astun-unstun cycle(power on, resume after suspend, migrate, or snapshot create/delete/revert) before the reconfiguration takes effect.

In my case i will create/delete a snapshot since I don’t want any downtime to occur.

State of my the VM files, before the Snapshot,
State of my VM files, after the creation of the Snapshot.
State of my VM Files, after the deletion of the Snapshot.

CBT is now enabled on this VM.

How to Check if CBT is enabled on your VM (PowerShell/PowerCli)</b>

# Check if your VM has (Change Block Tracking) enabled or not
(Get-VM -Name TESTSERVER04).ExtensionData.Config.ChangeTrackingEnabled

# Find VMs where CBT (Change Block Tracking) is Enabled
Get-VM| Where-Object{$_.ExtensionData.Config.ChangeTrackingEnabled -eq $true}






Leave a comment