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 stats --mode shows how big your repository really is

Backup
~/tips/tip-backup-restic-stats-mode

restic stats

Counts the data in a restic repository in four modes, from restore size to raw blobs.

Restic’s deduplication makes the question ‘how big is my backup?’ less simple than it sounds. restic stats has several answers.

restic stats
restic stats --mode raw-data

The default mode is restore-size, the size you need to restore the files. The other modes from the docs:

  • files-by-contents: the total size of unique files, judged by their contents.
  • raw-data: the size of the blobs in the repository, regardless of how many files refer to them.
  • blobs-per-file: a mix between the previous two.

Pick the mode that fits your question and keep using the same one, because the numbers differ between modes. A related detail: the size column in restic snapshots only exists for snapshots made with restic 0.17.0 or later.

I’d run restore-size when I wonder whether a restore fits on a disk, and raw-data when I wonder what the repository itself takes. Both questions are fair, they just have different answers. The page doesn’t give example output, so I’m not going to guess at numbers here.

The docs examples pass latest as the snapshot, as in restic stats latest, so you can look at the newest snapshot instead of the whole repository. You can narrow the selection with --host, --tag and --path. One caveat from the manual concerns files-by-contents: a small edit to a large file can make it count as a different file, so the whole size of that file is counted twice.

Further reading: restic manual

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" tmutil verifychecksums /path/to/backup-item All Backup tips (45) All topics

Link