brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: restic copy duplicates snapshots into a second repository

Linux
~/tips/tip-backup-restic-copy

restic -r /srv/restic-repo-copy copy --from-repo /srv/restic-repo

Copies snapshots from one restic repository into another, for example to keep an offsite second copy.

One backup location is not much of a plan. restic copy takes snapshots from one repository and writes them to another, which fits a setup with a local repository and an offsite one.

restic -r /srv/restic-repo-copy copy --from-repo /srv/restic-repo

This copies every snapshot from the source repository to the destination, here /srv/restic-repo-copy. Snapshots that were copied before are skipped by later runs, and if the copy is aborted it resumes the next time you run it. The docs add that up to ten minutes of progress can be lost on an interruption, because the repository index is only updated from time to time.

The destination has to exist already. Create it with the source’s chunker parameters so deduplication keeps working:

restic -r /srv/restic-repo-copy init --from-repo /srv/restic-repo --copy-chunker-params

The source password can come from a file with --from-password-file, and --from-key-hint picks the key used for decryption.

The caveats in the docs are real. Copying has to download and upload the whole snapshot, because the source and destination use different encryption keys. On a remote repository that can mean more bandwidth and cost than a normal backup run. It does not re-chunk files either, which can break deduplication between the copied files and files that already existed in the destination, so those may take up to twice their space there. Matching chunker parameters, as above, avoids that.

Also remember that a copy is not a replacement for checking. Run restic check on the destination once in a while, so you know the second repository can really be read.

Further reading: restic docs: Working with repositories (copy)

More Linux tips a2query -m rewrite renice -n 10 -p 4242 cat config.yml | xsel -ib xvfb-run -a your-program --some-flag dpkg --get-selections > packages.txt All Linux tips (261) All topics

Link