1
2
3 Disable virtual machine relocation with the VixDiskLib_PrepareForAccess() call.
a TRUE for high performance read-only access, FALSE for read/write access.
b Snapshot moRef, if applicable.
c NULL to accept transport method defaults (recommended).
5 Re-enable virtual machine relocation with the VixDiskLib_EndAccess() call.
6 Find VixDiskLib_Disconnect() near the end of program, and for safety add a VixDiskLib_Cleanup() call immediately afterwards.
■ Using the vSphere API (PropertyCollector), capture configuration (VirtualMachineConfigInfo) and changed block information (with queryChangedDiskAreas). Save these for later.Backing Up Virtual Disks in vSphere presents these algorithms in more detail and includes code samples. For best practices in backup and restore, see Tips and Best Practices.The VMware vSphere API method queryChangedDiskArea returns a list of disk sectors that changed between an existing snapshot, and some previous time identified by a change ID.The queryChangedDiskAreas method takes four arguments, including a snapshot reference and a change ID. It returns a list of disk sectors that changed between the time indicated by the change ID and the time of the snapshot. If you specify change ID as * (star), queryChangedDiskAreas returns a list of allocated disk sectors so your backup can skip the unallocated sectors of sparse virtual disk.Suppose that you create an initial backup at time T1. Later at time T2 you take an incremental backup, and another incremental backup at time T3. (You could use differential backups instead of incremental backups, which would trade off greater backup time and bandwidth for shorter restore time.)
1 Keep a record of the virtual machine configuration, VirtualMachineConfigInfo.
2 Create a snapshot of the virtual machine, naming it snapshot_T1.
3 Obtain the change ID for each virtual disk in the snapshot, changeId_T1 (per VMDK).
4
5
1 Create a snapshot of the virtual machine, naming it snapshot_T2.
2 Obtain the change ID for each virtual disk in the snapshot, changeId_T2 (per VMDK).
3
4
1 Create a snapshot of the virtual machine, naming it snapshot_T3.
2 Obtain the change ID for each virtual disk in the snapshot, changeId_T3 (per VMDK).
3
4
1 Create a new virtual machine with no guest operating system installed, using configuration parameters you previously saved from VirtualMachineConfigInfo. You do not need to format the virtual disks, because restored data includes formatting information.