That’s not the case, restic check only reports but does not change the repo (except adding a lock file).
Exactly, if it exits non-zero, there’s something you need to do.
There’s also a way to regularly read all data back from the repo, but nothing at once: pass --read-data-subset 1/10 to restic check, for that particular run restic will read the first tenth of all data files. On the next run, pass --read-data-subset 2/10 and it’ll read the next tenth. After running with --read-data-subset 10/10, restic will have read almost all data in the repo.
This way, you can split reading all the files in up to 256 runs.
I had just had a chance to perform a cleanup and I get errors when I run the restic prune.
Basically I have done rebuild-index, backed up latest changes, performed a prune (in that order) and everything seemed ok until prune threw the following errors:
========================================================
PS C:\Users\User> restic -r W:\restic\ rebuild-index
enter password for repository:
repository a6a81653 opened successfully, password is correct
counting files in repo
[29:52] 100.00% 55042 / 55042 packs
finding old index files
saved new indexes as [32292f56 93dbd91d 69861b50 7319c3b0 6857e992 637a3587 bfa489fd ea9d3638 450a1111 150e8c4b 02646ac5 cc2b3eeb 884d9cca 2c737c9e c846d7f9 5b8138e8 356e99dd 6515333a c72f3ad4]
remove 19 old index files
PS C:\Users\User> restic --exclude "D:\*RECYCLE*" --exclude "D:\Config.Msi*" --exclude "C:\Users\User\Documents\My Music*" --exclude "C:\Users\User\Documents\My Pictures*" --exclude "C:\Users\User\Documents\My Videos*" --exclude "D:\System Volume Information*" -r w:\restic\ backup C:\Users\User\Pictures C:\Users\User\Downloads C:\Users\User\Documents
D:\
open repository
enter password for repository:
repository a6a81653 opened successfully, password is correct
Files: 15 new, 2 changed, 265890 unmodified
Dirs: 0 new, 3 changed, 0 unmodified
Added to the repo: 11.484 MiB
processed 265907 files, 240.022 GiB in 1:46
snapshot e4a084b3 saved
PS C:\Users\User> restic -r W:\restic\ prune
enter password for repository:
repository a6a81653 opened successfully, password is correct
counting files in repo
building new index for repo
[30:24] 100.00% 55045 / 55045 packs
incomplete pack file (will be removed): 00b95d3dbe2837cea815ea7a581b67076beffaaa38086a61242080aed2ed98c9
incomplete pack file (will be removed): 01adbbb734c69f44edc28a6eb9ae32af12066c88a051c0d1373fb0b6e31394b5
incomplete pack file (will be removed): 05f8b33c3cf34b810674ef1ba74aed7b1a8bac124b7ac66c68acb317668698ae
incomplete pack file (will be removed): 08471b76322a1eec5ac4a449b2a85268acf0ad9fa87710ce513b2273d67a6a77
repository contains 54950 packs (432899 blobs) with 261.057 GiB
processed 432899 blobs: 4171 duplicate blobs, 4.262 GiB duplicate
load all snapshots
find data that is still in use for 9 snapshots
tree cee759a90802904dcdbe733403dd452f8d709dc637d8fc97b966fc7c07838476 not found in repository
github.com/restic/restic/internal/repository.(*Repository).LoadTree
/restic/internal/repository/repository.go:653
github.com/restic/restic/internal/restic.FindUsedBlobs
/restic/internal/restic/find.go:11
github.com/restic/restic/internal/restic.FindUsedBlobs
/restic/internal/restic/find.go:31
github.com/restic/restic/internal/restic.FindUsedBlobs
/restic/internal/restic/find.go:31
github.com/restic/restic/internal/restic.FindUsedBlobs
/restic/internal/restic/find.go:31
github.com/restic/restic/internal/restic.FindUsedBlobs
/restic/internal/restic/find.go:31
github.com/restic/restic/internal/restic.FindUsedBlobs
/restic/internal/restic/find.go:31
main.pruneRepository
/restic/cmd/restic/cmd_prune.go:191
main.runPrune
/restic/cmd/restic/cmd_prune.go:85
main.glob..func17
/restic/cmd/restic/cmd_prune.go:25
github.com/spf13/cobra.(*Command).execute
/restic/vendor/github.com/spf13/cobra/command.go:762
github.com/spf13/cobra.(*Command).ExecuteC
/restic/vendor/github.com/spf13/cobra/command.go:852
github.com/spf13/cobra.(*Command).Execute
/restic/vendor/github.com/spf13/cobra/command.go:800
main.main
/restic/cmd/restic/main.go:86
runtime.main
/usr/local/go/src/runtime/proc.go:201
runtime.goexit
/usr/local/go/src/runtime/asm_amd64.s:1333
PS C:\Users\User>
========================================================
I am not sure what to make of this.
Restic version is: restic 0.9.4 compiled with go1.11.4 on windows/amd64
Windows version is Win 10 Home
*Note: some sections of the output has been removed to keep the post reasonably small.
So a specific tree (directory) object is still missing. You can figure out what snapshot(s) reference it with restic find --tree cee759a90802904dcdbe733403dd452f8d709dc637d8fc97b966fc7c07838476.
@zavedf My suspicion is that the snapshot that references the missing tree is a snapshot that was created before you manually deleted some data files from the repository. As mentioned previously, running rebuild-index should ensure that future backups don’t try to deduplicate with missing objects, so any snapshots taken since you ran that command should be intact. We can verify this after this find bug is fixed.
@cdhowie thank you for looking into this and noted on the future backups not referencing the missing index files.
I will look forward to this fix when available. In the mean time please let me know if prune would work with other forgotten repositories? I am unable to verify the results since I mostly see the same error on screen.
At the moment I am still open to deleting the original repository and creating a fresh install if this is the only way since the amount of data I am backing up is not massive.
I assume by “repositories” you meant “snapshots.” If so, the answer is probably no, not until we can figure out which snapshot(s) reference the missing object(s).
This should not be necessary… basically you have a repository that can’t be pruned or checked at the moment, but it should still correctly store new backups.
If you want to verify this, you can try restoring your most recent backup into a new directory temporarily, and make sure that the operation completes successfully.
I have a PR that fixes restic find aborting when a tree can’t be loaded. Instead it will show you the tree ID and the snapshot it’s looking in, the implication being that if you forget the snapshot, the tree isn’t needed anymore.
Hi, I would like to check if there is instructions to updating restic in Windows Powershell installed via Scoop?
Scoop Update did not update Restic and restic self-update gets an error message Fatal: unable to update restic: unable to remove target file: remove C:\Users\User\scoop\apps\restic\current\restic.exe: Access is denied.
Thank you for your response. I have noticed the same error when I tried doing the self-update in my Linux VM. Restic was installed using the APT package manager.