Wednesday, August 14, 2013

PowerCLI: How To Enable Change Block Tracking (CBT)

VMware Change Block Tracking (CBT) is a feature that assists in incremental VM backups.   The virtualization layer identifies the disk sectors which have changed within the virtual disk.  The backup software can then leverage CBT and request only the blocks that have changed since the last backup.  Incremental backups are waaaay faster.

The ESX(i) host must be version 4.0 or above and the VM version must be at least 7.

To enable CBT using PowerCLI run the following: (Thanks Lazywinadmin.com !):

$vmtest = Get-vm myvmname| get-view
$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec
$vmConfigSpec.changeTrackingEnabled = $true
$vmtest.reconfigVM($vmConfigSpec)
This can be run against a VM which is powered on.  (The VM must be powered off using the method in the VMWare KB).

To "fully" activate CBT, the VM must go through a "stun-unstun" cycle.   I typically just create a snapshot, then immediately delete it.

To confirm that CBT has been activated, browse to the folder of the VM and confirm that for each vmdk file, there is a corresponding xxxx-ctk.vmdk file:




1 comment: