SECOND ROUND: Help final testing of Windows VSS support!

No, the VSS service should be running in the background all the time. You can check your running services for the VSS service. The only thing you need to do is run restic backup with the new flag --use-windows-vss --use-fs-snapshot. I don’t see this in the logs you posted. For more details and examples have a lookt at my first post in the PR at Support for Volume Shadow Copy Service (VSS) on windows by fgma · Pull Request #2274 · restic/restic · GitHub

The --use-window-vss is exactly what was needed and it worked. However I don’t think there is anything in the logs which would say that this option is being used. So I was able to backup C:\ without anything being written to stderr. I then did a restore of C:\Users\ to another drive then ran WinMerge, which actually is a diff style program, and it show that things were mostly identical. They were different mainly because of excluding cache. Actually excluding cache is excluding too much at least for one file. There is a python source file called linecache.py https://pymotw.com/2/linecache/ which gets excluded. Is it possible to exclude only directories which match cache?

If you run with --use-windows-vss --use-fs-snapshot it will log information when creating snapshots. See https://github.com/restic/restic/pull/2274#issuecomment-677482063 or https://github.com/restic/restic/pull/2274#issuecomment-683151351 for an example log.

Yes it does log information
‘’’
creating VSS snapshot for [c:]
successfully created snapshot for [c:]
‘’’
but if it would be possible could it follow the --json flag and output the message with a message type of “status”? I have a program which reads the stderr and stdout so if the formatting is consistent things would be better.
Thanks for getting back to me so quickly.

It is already using the ArchiveProgressReporter in cmd_backup.go. This is passed down and used for all logging. I don’t see what to add here. Maybe someone with more experience in the logging architecture of restic can give me some hints on how to improve the PR.

I’ve been using this to backup my personal system for the last few weeks. To be thorough, I’ve been A/Bing this alongside v0.9.6 to a clone of the same repository (so I run a backup with v0.9.6, and then a backup with this an hour later). The PR has worked exactly as intended for me; backups (including open files) are fine, restores are fine, and the content of said backups appears exactly as it should be. The only critique I have is that if the restic backup run is interrupted, you wind up with a stale/orphaned VSS snapshot hanging around:

PS C:\restic-troix> .\restic.exe backup --use-windows-vss --verbose --repo 'c:/restic_repo' 'C:\Morrowind'
open repository
repository 068c0d8c opened successfully, password is correct
lock repository
load index files
start scan on [C:\Morrowind]
start backup on [C:\Morrowind]
creating VSS snapshot for [c:\]
successfully created snapshot for [c:\]
signal interrupt received, cleaning up
PS C:\restic-troix> vssadmin list shadows
vssadmin 1.1 - Volume Shadow Copy Service administrative command-line tool
(C) Copyright 2001-2013 Microsoft Corp.

Contents of shadow copy set ID: {89cca202-fb16-4278-becd-068acd1e7dee}
   Contained 1 shadow copies at creation time: 20/09/2020 12:03:26
      Shadow Copy ID: {ac84baa4-82b6-488b-ae79-cc39818b736e}
         Original Volume: (C:)\\?\Volume{92e176e0-2660-4d2f-ac02-d73f529c88a1}\
         Shadow Copy Volume: \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy23
         Originating Machine: Elsenova
         Service Machine: Elsenova
         Provider: 'Microsoft Software Shadow Copy provider 1.0'
         Type: Backup
         Attributes: Differential, Auto recovered

PS C:\restic-troix>

Subsequent runs don’t touch this shadow copy, so it remains on the system until cleaned up manually.

That said, the set of scripts I normally use for backups has exactly the same problem (https://github.com/kmwoley/restic-windows-backup/issues/8), so I don’t consider it a deal-breaker, and would happily use the PR as-is!

1 Like

To the uninitiated whats the benefits of using vss over the current way that backups are conducted?

Also I just tested backing up files with vss executable and it went without a hitch. Il test restore tommorow and update this post.

It’s a matter of Windows locking certain files whereby you have to use VSS to back them up properly. It doesn’t matter much for your occasional Word document, but for things like MSSQL databases and other things it’s a must.

Is there a prebuilt binary for restic 0.10 with the VSS PR?

No, sorry. The code is polished quite fast as well (minor changes though).

If you want we can build one for you if you don’t want to build one yourself (very easy, just go run build.go after cloning the restic GitHub repository).

I compiled the lasted one about a week ago. Seems okay so far.

1 Like

Thought I would test the VSS enhancement but when I run that binary it says “unknown flag:–use-windows-vss”. That build identifies itself as “restic 0.10.0-dev (compiled manually) compiled with go1.15.2 on windows/amd64”
Is it just me?

1 Like

It’s called –use-fs-snapshot now.

1 Like

The Windows VSS PR has now been merged and is part of the master branch!

One can download and use the latest master build from: https://beta.restic.net/?sort=time&order=desc

Hello!

thank you for such update, it was surprise for me, so i tried to use restic on my new installation.

when i try to do backup with admin rights - it works as expected.
when i try to do backup with “Backup Operator” rights - i see this:
VSS error: The caller does not have sufficient backup privileges or is not an administrator: E_ACCESSDENIED (0x80070005)

command that i use:
restic.exe backup --use-fs-snapshot --exclude=“System Volume Information” “D:/”

is that bug? or only admin’s can use it?

@mrPsycho Please see the following article in regards to permissions/rights needed for the VSS snapshot creation, and try the “Backup Operators” group: Security Considerations for Requesters - Win32 apps | Microsoft Docs

Some notes what I’ve seen so far in 0.11.0 using --use-fs-snapshot in a laptop backup to an external drive.

The pagefile and swap are backed up. This indicates that the following registry setting is ignored. Because the pagefile.sys is listed as one those be ignored during a backup.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\BackupRestore\FilesNotToBackupHKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\BackupRestore\FilesNotToBackup

Pagefile and swap not backed up when doing a regular backup that doesn’t use the snapshot switch.

The hiberfil.sys is another big one. According to Microsoft documentation this ignored by VSS because the hibernation file is something you would never want restore. This is not backed because the file backup error returns “Access is denied”. There are actually about 70 files that restic cannot read from the temporary snapshot it creates. These reading errors are for files not listed in any registry exclusions. Any ideas what is going on here?

Probably not important because restic is for data backup/recovery, not for system crash consistent recoveries.

You probably need set up an exclusion file. That are a minimum (some may never be backed up but leave them in, just in case)

C:$$Recycle.Bin
C:\pagefile.sys
C:\hiberfil.sys
C:\swapfile.sys
C:\ProgramData\Microsoft\Windows Defender\Definition Updates\Backup\*
C:\ProgramData\Microsoft\Windows Defender\Support\*.log
C:\Windows\Temp\MpCmdRun.log
C:\Windows\SoftwareDistribution\DataStore\Logs\*
C:\Users\*\AppData\Local\Temp\Diagnostics\*
C:\Windows\SoftwareDistribution\Download\*
C:\ProgramData\Microsoft\Network\Downloader*
C:\Windows\system32\LogFiles\WMI\RtBackup\*.*
C:\Windows\memory.dmp
C:\System Volume Information\*

Used BleachBit and CCleaner to see what they cleaned up and picked these as optional

C:\Users\*\AppData\Local\Mozilla\Firefox\Profiles\*\cache2*
C:\Users\*\AppData\Local\Thunderbird\Profiles\*\startupCache*

Other Stuff
While testing found running command like this plus attempted to pick up logs.
restic -r V:\BKUP\repo-test_VSS -p V:\BKUP\restic\restic_pwd.txt backup --use-fs-snapshot C:\ 1>log_stdout_VSS.txt 2>log_stderr_VSS.txt

log_stdout_VSS.txt each line contained a lot unnecessary characters which rendered the formatting unsuitable for quick analysis. Its not formatted for windows.
log_stderr_VSS.txt contents formatted nicely, easy to work with.

The archive bit on files is not set by any restic backup with/without snapshots, a good thing.

This registry key is irrelevant to VSS:

See this issue.