Featured, Virtualization Software, VMware

Using vSphere Changed Block Tracking with EMC Networker Backup

Changed Block Tracking (CBT) is a feature that has been around for a while within VMware virtual machines.  CBT is available if you’re running ESX 4.0 or higher with hardware version 7 or higher on the VM. Basically, VMware can keep track of disk sectors that have changed since the last backup. When that VM is backed up again, and CBT is enabled, the backup will only need to copy the changed blocks.

The CBT Lightswitch

Though CBT is a feature present on more recent versions of VMware VMs, this feature is not automatically enabled. In some cases, there is no need to worry.  For example, if you’re running something like Veeam, a very popular virtual backup solution, that product will automatically enable CBT.  However, recently I was working with a coworker who was installing EMC Networker, and we discovered we would need to enable CBT somewhat manually.  The Networker VMware integration guide includes some methods for doing this, however there is a way to use VMware PowerCLI to do this as well.  Obviously anything we can do through PowerCLI can also be scripted and tweaked as we like. In this article I’ll include the commands you need to simply enable CBT on a powered on VM.

PowerCLI is Key

If you don’t already have it, you need to download and install VMware PowerCLI.  You can find more information on that here. Once that’s running go through the rest of the guide to make sure it’s set up properly.  Now we can move on to the commands.

First connect to your vCenter server by typing:

Connect-VIServer vCenter

Where vCenter is the name of your vCenter server. Then type:

$vm = Get-vm VM01 | get-view

$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec

$vmConfigSpec.chageTrackingEnabled = $true

$vm.reconfigVM($vmConfigSpec)

 

Where VM01 is the name of the VM in which you are enabling CBT.  This essentially assigns the VM to the $vm variable and then creates a config where CBT is enabled. It then applies that new config to the VM you’re currently working with. If this were a script we’d have to somehow create a way to read in VMs and check for the hardware version.

But Wait, There’s More!

We’re not quite done yet. If we were to enable CBT using the vCenter client as described in this KB article we would need to power off the VM first. By doing it through the command line we can leave the VM powered on, but we still need some way to apply it. If we don’t want down time then we can create a snapshot of the VM. Once it’s complete just go ahead and remove it. At this point CBT will be enabled. Keep in mind, though, if you have independent persistent disks configured you cannot create snapshots. Any VMs configured with independent persistent disks will need to be powered off and powered back on again.  Another point to bring up with independent persistent disks, particular to the use of Networker and VADP (vStorage APIs for Data Protection) in general, is it is not supported. Networker will skip backing these types of disk up. You must use a more traditional backup client style backup when backing up VMs with independent persistent disks.

With CBT enabled we can go ahead and start using Networker with CBT capabilities which will really decrease the amount of time it takes to create backups of VMs.