borgbackupserver icon indicating copy to clipboard operation
borgbackupserver copied to clipboard

Feature request: VSS (Volume Shadow Copy) snapshot support for the Windows agent

Open ricardodfg opened this issue 1 week ago • 0 comments

Description

Add VSS (Volume Shadow Copy) support to the Windows agent, using the existing plan "snapshot" option (today Linux-only: get_snapshot_support() in agent/bbs-agent.py returns "not capable" on Windows).

When "snapshot" is enabled on a plan and the agent runs on Windows:

  1. For each volume referenced by the plan's directories, create a shadow copy via WMI Win32_ShadowCopy.Create (works on both client and server editions, unlike vssadmin create shadow).
  2. Expose it through a temporary symlink to \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopyN\ and run borg create against the shadow paths, keeping archive paths identical to the original ones (same approach as the existing Linux snapshot root / per-plan mount path, #557).
  3. Always remove the shadow copy and the link in a cleanup step, and reuse cleanup_stale_snapshots() to remove orphaned shadows after a crash or reboot.
  4. If VSS fails, fall back to a normal backup with a clear warning, or fail the job (configurable), and log the reason.

Nice to have

  • Show VSS capability per volume in the plan editor, like the Linux snapshot support.
  • Later iteration: VSS writer awareness (at least SQL Server / Exchange).

Environment: BBS v2.102.0 (bare metal, Ubuntu 24.04), agents on Windows Server 2022/2025 and Windows 10/11, running as LocalSystem. Happy to test pre-releases.

Use Case

Without VSS, Windows backups cannot reliably capture open or locked files: Outlook PST, local database files of ERP/accounting software, Access-style files, and files open on SMB shares. These are skipped with sharing violations or captured in an inconsistent state, so a "successful" backup may not be restorable for exactly the files that matter most.

We are an MSP evaluating BBS to replace our current per-client Kopia setup. Windows file servers and small ERP servers are a large part of our fleet, and VSS is the main blocker to moving them to BBS. Other tools already support it, e.g. Kopia (osSnapshotMode) and restic (--use-fs-snapshot).

Alternatives Considered

  • Pre/post hook scripts that create and mount the shadow copy manually: possible, but archive paths change (the shadow mount path ends up in the archive), restores become confusing, and every MSP has to maintain its own fragile scripts.
  • Scheduling backups outside business hours: reduces the problem but doesn't solve it for 24/7 services or files left open overnight.
  • Database dump plugins (e.g. MSSQL): cover SQL Server, but not file-based databases or PST files.

ricardodfg avatar Nov 24 '26 15:11 ricardodfg