VixDiskLib_QueryAllocatedBlocks returns the sectors of a virtual disk that are in use. QueryChangedDiskAreas returns the sectors that changed since the time of a specified changeId
.
The current implementation depends on VMFS properties, similar to properties that SAN transport mode uses to locate data on a SCSI LUN. Both rely on unallocated areas (file holes) in virtual disk, and the LazyZero designation for VMFS blocks. Thus, changed block tracking yields best results on VMFS. On other storage types, it could fail, or returns a single extent covering the entire disk.
You should enable changed block tracking in the order recommended by Enable Changed Block Tracking. At first call VixDiskLib_QueryAllocatedBlocks to get allocated areas of virtual disk, and back them up. Subsequently call QueryChangedDiskAreas to get changed areas, and back them up if they were allocated. If you call QueryChangedDiskAreas after a snapshot but before you enable changed block tracking, it also returns unallocated areas of virtual disk. With thin-provisioned virtual disk this could be a large amount of zero data.
The guest operating system has no visibility of changed block tracking. Once a virtual machine has written to a block on virtual disk, the block is considered in use. The information required for tracking is computed when changed block tracking is enabled, and the .ctk file is pre-filled with allocated blocks. The mechanism cannot report changes made to virtual disk before changed block tracking was enabled.