Overview of the Backup Discovery Phase

After calling IVssBackupComponents::GatherWriterMetadata, a requester uses the instance of the IVssAsync interface returned from this call to determine when all writers on the system have finished constructing their Writer Metadata Documents. For more information, see Overview of Processing a Backup Under VSS.

At this point, the requester can begin a discovery phase, examining metadata to determine what applications are running and which volumes must be shadow copied to get a complete backup. The following table shows the sequence of actions and events that are required for the backup discovery phase.

Requester action Event Writer action
Retrieve Writer Metadata Documents (see IVssBackupComponents::GetWriterMetadata, IVssExamineWriterMetadata). None During this period, writers may be able to continue with their normal operations.
Use the list of components and their file sets, as well as excluded files, to obtain a list of volumes and files involved in the backup (see IVssWMComponent, IVssWMFiledesc). None None
Choose which components in the writer's Writer Metadata Document to back up. Call IVssBackupComponents::AddComponent for each component to add it to the Backup Components Document. (See Working with Selectability for Backup and Working with the Backup Components Document.) None None
Initialize the shadow copy set, context and check for supported volumes (see IVssBackupComponents::StartSnapshotSet, IVssBackupComponents::IsVolumeSupported). None None
If performing a non-component backup, add the desired target volumes from the Writer Metadata Document to the shadow copy set by calling IVssBackupComponents::AddToSnapshotSet for each volume. Otherwise, for the components in the Writer Metadata Document that were already added to the Backup Components Document (by calling AddComponent), the requester must also call IVssBackupComponents::AddToSnapshotSet for each affected volume. None None


Writer Actions during the Discovery Phase

Because the discovery phase of a backup consists primarily of a requester processing the information it has retrieved from Writer Metadata Documents, there are few if any requirements on a writer.

In theory, a writer could continue to run normally at this point. However, it may be desirable for writers to begin preparations for the coming shadow copy and backup operations.

Requester Actions during the Discovery Phase

A requester uses the IVssExamineWriterMetadata objects obtained through IVssBackupComponents::GetWriterMetadata to iterate over all the writers' metadata and selecting those writers whose data it intends to back up.

At this point, the requester will need to generate an initial list of each writer's backup candidates by iterating over the writer's components using IVssExamineWriterMetadata::GetComponent. This provides the requester with IVssWMComponent objects, from which you can get the specifications for the files to be backed up using IVssWMComponent::GetFile, IVssWMComponent::GetDatabaseFile, and IVssWMComponent::GetDatabaseLogFile.

Because the IVssWMFiledesc object can use wildcard characters to hold file location information, it may be necessary to use functions such as FindFirstFile, FindFirstFileEx, and FindNextFile.

Until the shadow copy has been completed, it is still possible for writers to add or remove files from disk in the normal course of their work, so you should not generate the actual list of files to be backed up at this time.

Instead, the initial list of files and volumes to be backed up is found at this point by doing the following:

  1. Examining all selectable for backup and nonselectable components in each writer's Writer Metadata Document (using IVssExamineWriterMetadata) and organizing them into component sets use logical path (see Working with Selectability and Logical Paths)
  2. Including explicitly all required components (nonselectable for backup components without selectable for backup ancestors) in the Backup Components Document using IVssBackupComponents::AddComponent
  3. Choosing to explicitly include optional selectable for backup components that do not define a component set (using IVssBackupComponents::AddComponent)
  4. Selecting component sets for participation in a backup by explicitly adding their defining selectable for backup component (using IVssBackupComponents::AddComponent), which implicitly includes the component set's subcomponents.
  5. Using file set information in the selected writers' Writer Metadata Document and volume management functions, a requester determines the paths of files to be backed up and the volumes that will need to be shadow copied

Note that only the components explicitly included (using IVssBackupComponents::AddComponent) in the backup and in the Backup Components Document will have instances of the IVssComponent interface added to that document. These instances will be used to examine and modify component settings for both explicitly included components and any of their implicitly included subcomponents (see Selectability and Working with Component Properties).

If a writer includes any of a writer's components, it must add all of its required components. However, a requester is also free to entirely skip all of a writer's component sets. If none of a writer's components are explicitly selected, the writer is not selected, and VSS inhibits that writer from participating in the rest of the backup operation.

The requester initiates the shadow copy set that will contain the selected volumes by calling IVssBackupComponents::StartSnapshotSet.

If the volume can participate in a shadow copy (which can be checked with IVssBackupComponents::IsVolumeSupported), the requester can add that volume to the shadow copy set using IVssBackupComponents::AddToSnapshotSet.

Although it is not generally useful, a requester can sometimes also choose which provider will maintain the shadow copy for a given volume (see Selecting Providers for details).

Care should be given to the handling of a volume containing mounted folders or reparse points. A mounted folder or reparse point can appear in a shadow copy and can be backed up. However, a mounted folder or reparse point cannot be traversed on the shadow copied volume (see Working with Mounted Folders and Reparse Points).

At this point in the backup, the Backup Components Document is initialized and filled. In future operations, writers and requesters can use the IVssComponent interface to communicate with each other.

Writers are given access to the IVssComponent interface when handling the PrepareForBackup, PostSnapshot, and BackupComplete events.