Working with Alternate Paths during Backup
There are certain circumstances where the files to be backed up are not the default location for those files.
For example, some writers cannot guarantee to have flushed of their data within the time window between Freeze and Thaw events. Such writers may choose to generate duplicate files containing a last known good configuration in a non-default source directory, or alternate path.
The term alternate path, as used with VSS, should not be confused with the term alternate location mapping. Alternate paths are used only during backup operations, and refer to an alternate source from which to back up. Alternate location mappings are used only during restore operations, and refer to an alternate destination for restore operations.
To use an alternate path during backup
- During the discovery phase of a backup operation (see Overview of the Backup Discovery Phase) a requester would examine each writer's component data using IVssExamineWriterMetadata::GetComponent and get instances of the IVssWMComponent interface.
- A requester then obtains the file set managed by each component, represented by instances of the IVssWMFiledesc interface, by calling the IVssWMComponent::GetFile method.
- In addition to a path (IVssWMFiledesc::GetPath), a file specification (IVssWMFiledesc::GetFilespec), and a recursion flag (IVssWMFiledesc::GetRecursive), a IVssWMFiledesc object may contain an alternate location (used as an alternate path for backup operations and an alternate location mapping for restore operations) by using the IVssWMFiledesc::GetAlternateLocation method.
- If the value returned by IVssWMFiledesc::GetAlternateLocation is non-NULL, backup applications use that value instead of the value obtained from IVssWMFiledesc::GetPath to select and locate files to back up.
- Despite using an alternate path, requesters should still respect the file specification and recursive settings returned by IVssWMFiledesc::GetFilespec and IVssWMFiledesc::GetRecursive.
Note that on restore, any alternate path—that is, an alternate location returned by an instance of IVssWMFiledesc::GetAlternateLocation gotten from an instance of IVssWMComponent, which in turn was obtained from an instance of IVssExamineWriterMetadata gotten by retrieving a stored Writer Metadata Document—is not used during restoration.
Either the default path (returned by the GetPath method of the same instance of IVssWMFiledesc) is used to define a restore location, or an alternate location mapping—found by using the IVssWMFiledesc::GetAlternateLocation method—indicates where a file is to be restored (see Working with Alternate Locations during Restore).