Search code examples
c++windowsvolume-shadow-service

Volume Snapshot Service - ignore FilesNotToSnapshot


I'm using Volume Snapshot Services (VSS) to backup a drive. By default all files listed under HKLM\SYSTEM\CurrentControlSet\Control\BackupRestore\FilesNotToSnapshot are deleted from the snapshot by VSS.

How can I make VSS to keep those files? There is some software (for ex. Macrium Reflect) that is able to do that. Thank you.


Solution

  • On systems that have it (XP doesn't), the "Shadow copy optimization writer" is the one in charge of deleting unwanted files from the shadow copy after the snapshot is taken.

    I would either try to explicitely disable this writer, or call SetContext() with the VSS_VOLSNAP_ATTR_NO_AUTORECOVERY flag (it should prevent any post-snapshot write operation). However MSDN says that this flag has drawbacks.