5. From your NBD client, complete the following steps to export the changed blocks to the backup location. For
example, when using the Linux nbd-client:
a. Connect to the NBD server.
nbd-client <address> <port> -N <exportname> -cacertfile <cacert>
-tlshostname <subject>
• The <address>, <port>, <exportname>, and <subject> values passed as parameters to the connection
command are the values returned by the get_nbd_info call.
• The <cacert> is a file containing one or more trusted Certificate Authority certificates of which at
least one has signed the NBD server's TLS certificate. That TLS certificate is included in the values
returned by the get_nbd_info call. If the TLS certificate returned by the get_nbd_info call is
self-signed, it can be used as the value of cacert here to authenticate itself.
For more information about using these values, see Section 7.1, “Getting NBD connection information
for a VDI”.
b. Read off the blocks that are marked as changed in the bitmap returned from step 3.
c. Disconnect from the block device:
nbd-client -d <block_device>
d. Optional: We recommend that you retain the bitmap associated with each changed block export at your
backup location.
To complete the preceding steps, you can use any NBD client implementation that supports the “fixed
newstyle” version of the NBD protocol. For more information, see Section 7.2, “Exporting the changed blocks
using an NBD client”.
6. Optional: On the host, delete the VDI snapshot, but retain the metadata:
session.xenapi.vdi.data_destroy(<snapshot_vdi_ref>)
This frees up space on the host or SR.
For more information, see Chapter 5, Deleting VDI snapshot data and retaining the snapshot metadata.
2.2.3. Restoring a VDI from exported changed block data
When you want to use your incremental backups to restore or import data from a VDI, you cannot use individual
exports of changed blocks to do this. You must first coalesce the exported changed blocks onto a base snapshot.
Use this coalesced VDI to restore or import backed up data.
1. Create a coalesced VDI.
For each set of exported changed blocks between the base snapshot and the snapshot you want to restore to,
create a coalesced VDI from a previous base VDI and the subsequent set of exported changed blocks. Ensure
that you apply sets of the changed blocks to the base VDI in the order that they were snapshotted.
To create a coalesced VDI from a base VDI and the subsequent set of exported changed blocks, complete
the following steps:
a. Get the bitmap that was used in step 3 to derive this set of exported changed blocks.
b. For each block in the VDI:
• If the bitmap indicates that the block has changed, read the block data from the set of exported
changed blocks and append that data to the coalesced VDI.
• If the bitmap indicates that the block has not changed, read the block data from the base VDI and
append that data to the coalesced VDI.
c. Use the coalesced VDI as the base VDI for the next iteration of this step. Or, if you have reached the target
snapshot level, use this coalesced VDI in the next step to restore a VDI in XenServer.
For more information, see Chapter 8, Coalescing changed blocks onto a base VDI.
5