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 mount lets you browse your snapshots as a normal folder

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

restic -r /srv/restic-repo mount /mnt/restic

Mounts a restic repository through FUSE so you can browse and copy files from every snapshot.

Sometimes I do not know which snapshot holds the version of a file I want. Restoring snapshot after snapshot to compare them is slow, so restic mount is the nicer way to look around: it exposes the whole repository as a folder.

mkdir /mnt/restic
restic -r /srv/restic-repo mount /mnt/restic

The command stays in the foreground while the repository is mounted. In another terminal or your file manager you can open /mnt/restic, look through the snapshots, and copy out what you need with cp or Finder. When you are done, quit with Ctrl-C in the first terminal or unmount the folder.

The docs list a few requirements. Mounting only works on Linux, macOS and FreeBSD, and it needs FUSE. On Linux that means the fuse kernel module and fusermount in your PATH. On macOS you need FUSE-T or FUSE for macOS, which is worth knowing as I do most of my desktop work on a Mac. The mount point must not overlap the local repository directory, and restic refuses such a path.

The caveat is speed. The docs call the mount mostly useful for restoring just a few files out of a snapshot. For many files, restic restore is usually faster. If you restore hard links from a mount, the docs suggest a tool that preserves them, for example rsync --hard-links, since a plain copy will not.

Ordinary tools see the snapshots as plain folders, so any file manager or editor works on them. Treat the mount as read-only browsing and copy things out before you change them.

Further reading: restic docs: Restoring from backup (mount)

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