Shrink an Existing Local Disk
VixDiskLib_Shrink() reclaims unused space in an existing virtual disk, unused space being recognized as blocks of zeroes. This is more effective (gains more space) with SPARSE type files than with pre-allocated FLAT type. On success, the function returns VIX_OK. This function supports hosted disk, but not managed disk.
vixError = VixDiskLib_Shrink(disk.Handle(), ShrinkProgressFunc, NULL);
In VMware system utilities, “prepare” zeros out unused blocks in the VMDK so “shrink” can reclaim them. In the API, use VixDiskLib_Write() to zero out unused blocks, and VixDiskLib_Shrink() to reclaim space. Shrink does not change the virtual disk capacity, but it makes more space available.