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 backup --one-file-system keeps mounted disks out of a backup of /

Backup
~/tips/tip-backup-restic-one-file-system

restic -r /srv/restic-repo backup --one-file-system /

Keeps restic from crossing into other mounted filesystems when you back up a directory tree.

If you point a backup at /, it will happily walk into every disk mounted below it, including that USB drive or network share you forgot about. The flag --one-file-system stops restic at the border of the filesystem.

restic -r /srv/restic-repo backup --one-file-system /

The docs give a concrete case: with this flag, restic will not back up /media/usb at all because it is a different filesystem than /. The same goes for any other mount below the source, such as a share under /mnt. Without it, a backup of the root can quietly grow to include data you never meant to back up.

The other side of the coin matters more. Anything that lives on its own filesystem is also left out of a backup of /. On a typical server that can include /home, /var or a data pool that has its own mount. If your layout has separate partitions, name them as additional sources:

restic -r /srv/restic-repo backup --one-file-system / /home /var

The docs say that the option is currently unsupported on Windows and will cause the backup to fail with an error immediately, so keep it out of cross-platform scripts.

I would run the first backup with --dry-run -vv and look at what shows up, because the result depends entirely on how your disks are mounted. A snapshot that looks fine but misses /home is the kind of problem you only notice during a restore.

Further reading: restic docs: Backing up (one file system)

More Backup tips restic snapshots --group-by host,paths mysqldump --routines --events mydb > mydb.sql rsync -a --files-from=list.txt /home/me/ backup:/backup/ restic find "*.txt" restic stats All Backup tips (45) All topics

Link