Restic copy - diff & repair

I have been using restic right since 0.9.3 and was initially using rclone sync before restic copy was out.

Correct me if I am wrong :slightly_smiling_face:
I have observed restic copy faster than rclone sync maybe because restic only compares the snapshots and not data.

I had been doing a restic copy for quite a while now and ran a prune operation recently on the remote which ended up with missing packs. The local repo behind the restic-server prune successfully.

Doing a restic copy would report all snapshots saved within <1 min vs rclone sync would take around 15 mins comparing every file on both sides.

What maybe required…
A copy force like the backup force option that could fix errors in the remote directory.
OR
restic repo diff
restic repo diff --read-data
restic repo diff --read-data-subset 25%
Read and compare data from both repositories and report errors

restic repo repair
Fix the secondary repository.

I feel this is required just incase you loose your local repository and the only source of recovery is the secondary repository. A repository with missing packs can end up being useless.

Regards
Sd

To fix missing packs, you probably want to run rebuild-index at the remote repository, then temporarily move the files in the snapshots folder of the remote repository to somewhere else. Then run copy again which should now transfer all missing data. Afterwards remove the newly created snapshots and restore the previously existing snapshots. The part with moving snapshots around could be handled by adding support for a --force parameter to the copy command.

A repo-diff command is not that useful, just use check --read-data[...] to detect damaged data, then remove the damage and repair the missing blobs as described above.

1 Like

Interesting workaround… Will try this out

What is the point of deleting the newly created snapshots and replacing it with the old ones?

Regards,
Sd

No particular reason. The idea there was to keep the old snapshot ids. But if that’s not necessary you can skip that.

1 Like