Requester Role in VSS Incremental and Differential Backups

To support an incremental or differential backup operation, a requester must do the following:

  1. Determine what degree of writer support is available (using IVssBackupComponents::GetWriterMetadata to get access to information in Writer Metadata Documents)—in particular, determine which backup schema are supported (VSS_BACKUP_SCHEMA).
  2. Set an appropriate backup state.
  3. Obtain file and file set level specifications for an incremental or differential backup.
  4. Perform the backup.

Requester Determination of Incremental and Differential Support and Configuration

A requester needs to obtain information about writer support prior to selecting components for inclusion in an incremental or differential backup or setting its own state.

Determining Writer Support

A requester determines if a given writer supports VSS incremental or differential backups by retrieving the writer's backup schema mask using the IVssExamineWriterMetadata::GetBackupSchema method.

The backup schema mask of a writer supporting VSS incremental or differential techniques will contain either VSS_BS_INCREMENTAL or VSS_BS_DIFFERENTIAL, or both. Writers may also indicate restrictions on their participation with the VSS_BS_EXCLUSIVE_INCREMENTAL_DIFFERENTIAL flag. (See VSS_BACKUP_SCHEMA for more information on backup schemas).

Setting Requester Backup State

A requester indicates that a backup is an incremental or differential backup by setting a backup type to either VSS_BT_INCREMENTAL or VSS_BT_DIFFERENTIAL using the IVssBackupComponents::SetBackupState method prior to generating a PrepareForBackup event.

The IVssBackupComponents::SetBackupState method is also used to indicate whether the requester provides partial file support, which is frequently used to implement certain incremental backup and restore operations.

Getting Writer Specifications for Incremental and Differential Backups

The file-set-level file backup specification information (VSS_FILE_SPEC_BACKUP_TYPE) contained in each writer's Writer Metadata Document is available for examination after the successful return of IVssBackupComponents::GatherWriterMetadata.

However, a writer can add differenced files or ask for partial file support until its successful handling of the PostSnapshot event.

Differenced file and partial file support specification can override the file specification backup type, so requesters may want to defer a full analysis of all writer specifications about incremental and differential backups until after the successful return of IVssBackupComponents::PrepareForBackup.

Getting File Backup Specification Information

The file-set-level file backup specification information (VSS_FILE_SPEC_BACKUP_TYPE) is contained in each writer's Writer Metadata Document, and can be examined immediately after the successful return of IVssBackupComponents::GatherWriterMetadata.

Requesters must obtain file backup specification masks (VSS_FILE_SPEC_BACKUP_TYPE) for every file set of each of a writer's components to be included in the incremental or differential backup, regardless of whether the component was explicitly or implicitly included.

A requester can determine which writers' Writer Metadata Document must be queried by using IVssBackupComponents::GetWriterComponentsCount and IVssBackupComponents::GetWriterComponents. The instance of the IVssWriterComponentsExt interface returned by IVssBackupComponents::GetWriterComponents provides writer information through the IVssWriterComponentsExt::GetWriterInfo method.

The requester obtains component information through instances of the IVssWMComponent interface corresponding to an included component managed by a given writer by using IVssExamineWriterMetadata::GetComponent.

The information about file sets managed by the component corresponding to the IVssWMComponent interface is obtained by calls to IVssWMComponent::GetFile, IVssWMComponent::GetDatabaseFile, or IVssWMComponent::GetDatabaseLogFile (as appropriate).

These calls can return instances of the IVssWMFiledesc interface for each of a component's file sets.

A file set's file specification backup type is obtained by calling IVssWMFiledesc::GetBackupTypeMask.

Getting Partial File and Differenced File Information

A requester obtains partial file and differenced file information through the IVssComponent interface.

A requester can iterate over all writers included in a backup using IVssBackupComponents::GetWriterComponentsCount and IVssBackupComponents::GetWriterComponents.

The instance of an IVssWriterComponentsExt interface returned by IVssBackupComponents::GetWriterComponents provides access to all instances of the IVssComponent interface corresponding to a given writer's explicitly included components through the IVssWriterComponentsExt::GetComponent and IVssWriterComponentsExt::GetComponentCount methods.

A requester will need to go through all instances of IVssComponent for all writers whose schema support the incremental or differential backup—that is, writers whose backup schema mask, as returned by IVssExamineWriterMetadata::GetBackupSchema, includes VSS_BS_INCREMENTAL when the backup type is VSS_BT_INCREMENTAL, or VSS_BS_DIFFERENTIAL when the backup type is VSS_BS_DIFFERENTIAL.

Partial file information is obtained by calling IVssComponent::GetPartialFileCount and IVssComponent::GetPartialFile (see Working with Partial Files).

For writers that support backup operations on the basis of a file's last modification data (writers whose backup schema mask, as returned by IVssExamineWriterMetadata::GetBackupSchema, includes VSS_BS_LAST_MODIFY), differenced file information is obtained by calling IVssComponent::GetDifferencedFilesCount and IVssComponent::GetDifferencedFile.

Note that differenced files may be new files—that is, files that are not members of any file set currently in a given writer's Writer Metadata Document.

Requesters should not find files included both for partial file operations and as differenced files. If a requester does encounter such a circumstance, it should return and log a writer error.

A requester may still choose to proceed with backing up the problematic writer's files, but in that case should do so according to the specification found in the differenced file information.

Implementing Incremental or Differential Backups

Prior to implementing a backup, requesters should have information about which writers support an incremental or differential backup, all requested partial file operations, all differenced files, and the file specification backup type of all other files.

Nonsupporting Writers

Writers whose schema do not support the incremental or differential backup (writers whose backup schema mask, as returned by IVssExamineWriterMetadata::GetBackupSchema, includes VSS_BS_INCREMENTAL when the backup type is VSS_BT_INCREMENTAL or does not include VSS_BS_DIFFERENTIAL when the backup type is VSS_BS_DIFFERENTIAL) cannot provide any direct support to an incremental or differential backup operation.

This does not necessarily mean that the writers' data will not be involved in an incremental or differential backup operation. However, the choice of what to do is at the discretion of the requester. The requester can do any of the following:

  • Back up no files belonging to the nonsupporting writers (clearly indicate this to the user)
  • Back up all the files of nonsupporting writers
  • Perform an incremental backup using file system data and the requester's own history logs.

The last alternative should be used with great care, and only if the requester understands if the writers involved can support incremental or differential backup and restoration of data independent of the VSS mechanism.

Supporting Writers

A requester needs to process (in order) all of a writer's differenced files, then handle any partial file requests, and then back up remaining files according to their file specification backup type (VSS_FILE_SPEC_BACKUP_TYPE).

  1. Backing up Differenced Files:

    For writers that support backup operations on the basis of last modification data (writers whose backup schema mask, as returned by IVssExamineWriterMetadata::GetBackupSchema, includes VSS_BS_LAST_MODIFY), a requester uses the path, file specification, and recursion flag information returned by IVssComponent::GetDifferencedFile to generate a list of files as candidates for incremental backup or restore.

    IVssComponent::GetDifferencedFile can also return a time of last modification (expressed as a FILETIME structure).

    If the last modification time supplied by the writer is nonzero, then the requester uses it as the basis (rather than file system information or the requester's own stored data) for determining if the file should be included in the incremental or differential backup.

    For instance, if a file's last modification time as returned by the writer was:

    • After the last full backup, the file should be included in both incremental and differential backups.
    • After the last full backup but prior to the last incremental backup, the file should be included in incremental backup operations, but not differential backups.

    If the last modification time supplied by the writer is zero, then the requester must use file system information and its own stored data to determine the modification time of the differenced file.

  2. Using Partial File Operations:

    If a writer has requested that a file be backed up using a partial file operation, the requester uses the file offset information to save the indicated file segments to backup media. (See Working with Partial Files for more information on partial file operations).

    As noted above, a writer should not designate a file both as a differenced file and as a participant in a partial file operation. If a requester does encounter such a circumstance, it should return and log a writer error.

    A requester may still choose to proceed with backing up the problematic writer's files, but in that case should do so according to the specification found in the differenced file information.

  3. Working with File Specification Backup Type:

    Having processed all differenced files and partial file operations, the requester now processes all remaining files in its backup set on the basis of their file specification backup type (VSS_FILE_SPEC_BACKUP_TYPE).

    There are three "backup required" values of the VSS_FILE_SPEC_BACKUP_TYPE enumeration that affect differential and incremental backups:

    • VSS_FSBT_ALL_BACKUP_REQUIRED
    • VSS_FSBT_INCREMENTAL_BACKUP_REQUIRED
    • VSS_FSBT_DIFFERENTIAL_BACKUP_REQUIRED

    There are three "shadow copy required" values:

    • VSS_FSBT_ALL_SNAPSHOT_REQUIRED
    • VSS_FSBT_INCREMENTAL_SNAPSHOT_REQUIRED
    • VSS_FSBT_DIFFERENTIAL_SNAPSHOT_REQUIRED

    File sets tagged with a file specification backup type of "shadow copy required" indicate that a requester needs to copy data from a shadow copy when performing INCREMENTAL, DIFFERENTIAL, or ALL (which includes both incremental and differential operations) backup operations.

    The "backup required" flag, applied to INCREMENTAL, DIFFERENTIAL, or ALL backup operations, indicates that the writer expects a copy of the current version of the file set to be available following the restore of any backup operation. Typically, this means that if a file set is tagged with "backup required," a requester will copy all its members to backup media during an incremental or differential backup, regardless of when their backup or modification last occurred.

    By default, file sets are added to components with a file specification backup type of VSS_FSBT_ALL_BACKUP_REQUIRED | VSS_FSBT_ALL_SNAPSHOT_REQUIRED. Therefore, unless a writer explicitly sets the file specification backup type otherwise, requesters will need to copy those files not handled by partial file operations or designated differenced files in most file sets will typically be copied in their entirety to backup media.

Backup Stamps

Writers that support backup stamps (VSS_BS_TIMESTAMP) may choose to generate backup stamp information to be used to support future incremental and differential backup and restore operations.

The format and information contained in strings containing backup stamp information are private to the writer that generates them; the requester does not know how to process this information.

Supporting writers store the backup stamp in the Backup Components Document as a string by using the IVssComponent::SetBackupStamp method.

The requester's role in handling backup stamp information is (if it exists) to make it available to the writer by calling IVssBackupComponents::SetPreviousBackupStamp in a future backup or restore operation.