diff --git a/changelog/unreleased/pull-3067 b/changelog/unreleased/pull-3067 index 52f04c5e0..855c7f2be 100644 --- a/changelog/unreleased/pull-3067 +++ b/changelog/unreleased/pull-3067 @@ -2,21 +2,21 @@ Enhancement: Add options to configure Windows Shadow Copy Service Restic always used 120 sec. timeout and unconditionally created VSS snapshots for all volume mount points on disk. Now this behavior can be fine-tuned by -new options, like exclude user specific volumes and mount points or completely +new options, like exclude specific volumes and mount points or completely disable auto snapshotting of volume mount points. For example: - restic backup --use-fs-snapshot -o vss.timeout=5m -o vss.excludeallmountpoints=true - + restic backup --use-fs-snapshot -o vss.timeout=5m -o vss.exclude-all-mount-points=true + changes timeout to five minutes and disable snapshotting of mount points on all volumes, and - restic backup --use-fs-snapshot -o vss.excludevolumes="d:\;c:\mnt\;\\?\Volume{e2e0315d-9066-4f97-8343-eb5659b35762}" + restic backup --use-fs-snapshot -o vss.exclude-volumes="d:\;c:\mnt\;\\?\Volume{e2e0315d-9066-4f97-8343-eb5659b35762}" -excludes drive `D:`, mount point `C:\MNT` and specific volume from VSS snapshotting. +excludes drive `d:`, mount point `c:\mnt` and specific volume from VSS snapshotting. restic backup --use-fs-snapshot -o vss.provider={b5946137-7b9f-4925-af80-51abd60b20d5} - + uses 'Microsoft Software Shadow Copy provider 1.0' instead of the default provider. https://github.com/restic/restic/pull/3067 diff --git a/doc/040_backup.rst b/doc/040_backup.rst index 7360bb0e0..50de954ef 100644 --- a/doc/040_backup.rst +++ b/doc/040_backup.rst @@ -59,21 +59,21 @@ exclusively locked by another process during the backup. You can use additional options to change VSS behaviour: * ``-o vss.timeout`` specifies timeout for VSS snapshot creation, the default value is 120 seconds - * ``-o vss.excludeallmountpoints`` disable auto snapshotting of all volume mount points - * ``-o vss.excludevolumes`` allows excluding specific volumes or volume mount points from snapshotting + * ``-o vss.exclude-all-mount-points`` disable auto snapshotting of all volume mount points + * ``-o vss.exclude-volumes`` allows excluding specific volumes or volume mount points from snapshotting * ``-o vss.provider`` specifies VSS provider used for snapshotting -E.g., 2.5 minutes timeout with mount points snapshotting disabled can be specified as +For example a 2.5 minutes timeout with snapshotting of mount points disabled can be specified as .. code-block:: console - -o vss.timeout=2m30s -o vss.excludeallmountpoints=true + -o vss.timeout=2m30s -o vss.exclude-all-mount-points=true -and excluding drive ``D:\``, mount point ``C:\mnt`` and volume ``\\?\Volume{04ce0545-3391-11e0-ba2f-806e6f6e6963}\`` as +and excluding drive ``d:\``, mount point ``c:\mnt`` and volume ``\\?\Volume{04ce0545-3391-11e0-ba2f-806e6f6e6963}\`` as .. code-block:: console - -o vss.excludevolumes="d:;c:\MNT\;\\?\volume{04ce0545-3391-11e0-ba2f-806e6f6e6963}" + -o vss.exclude-volumes="d:;c:\mnt\;\\?\volume{04ce0545-3391-11e0-ba2f-806e6f6e6963}" VSS provider can be specified by GUID diff --git a/internal/fs/fs_local_vss_test.go b/internal/fs/fs_local_vss_test.go index cff881151..23e86b911 100644 --- a/internal/fs/fs_local_vss_test.go +++ b/internal/fs/fs_local_vss_test.go @@ -127,10 +127,12 @@ func TestParseMountPoints(t *testing.T) { if err != nil { t.Fatal(err) } - // We don't know a valid volume GUID path for C:\, but we'll at least check its format + // We don't know a valid volume GUID path for c:\, but we'll at least check its format if !volumeMatch.MatchString(sysVolume) { t.Fatalf("invalid volume GUID path: %s", sysVolume) } + // Changing the case and removing trailing backslash allows tests + // the equality of different ways of writing a volume name sysVolumeMutated := strings.ToUpper(sysVolume[:len(sysVolume)-1]) sysVolumeMatch := strings.ToLower(sysVolume) diff --git a/internal/fs/vss.go b/internal/fs/vss.go index a54475480..8bfffab71 100644 --- a/internal/fs/vss.go +++ b/internal/fs/vss.go @@ -33,7 +33,7 @@ func HasSufficientPrivilegesForVSS() error { return errors.New("VSS snapshots are only supported on windows") } -// GetVolumeNameForVolumeMountPoint clear input parameter +// GetVolumeNameForVolumeMountPoint add trailing backslash to input parameter // and calls the equivalent windows api. func GetVolumeNameForVolumeMountPoint(mountPoint string) (string, error) { return mountPoint, nil diff --git a/internal/fs/vss_windows.go b/internal/fs/vss_windows.go index 18aea419d..91c60c4ba 100644 --- a/internal/fs/vss_windows.go +++ b/internal/fs/vss_windows.go @@ -828,7 +828,7 @@ func HasSufficientPrivilegesForVSS() error { return err } -// GetVolumeNameForVolumeMountPoint clear input parameter +// GetVolumeNameForVolumeMountPoint add trailing backslash to input parameter // and calls the equivalent windows api. func GetVolumeNameForVolumeMountPoint(mountPoint string) (string, error) { if mountPoint != "" && mountPoint[len(mountPoint)-1] != filepath.Separator {