How to view all files available in repo/Am I misusing restic?

Hi everyone,

I’ve been going over the docs and I can’t figure this out. I think I’m either misunderstanding how restic works or misusing it and I’m not sure which.

I recently set up restic and I split up my restic backup calls so I can prioritize different data in a time-constrained nightly job. restic backup is first called on /foo then on /bar to ensure that more important data in /foo is backed up before anything else, in case there’s a large amount of new data in /bar that might take multiple nights to upload. It’s more complicated than that but that’s the basic idea.

When I restic ls latest it only shows files from whichever directory was last backed up and I can’t figure out how to list all files available in the repo. Is that just not a supported use case? Similarlly I can’t figure out how to restore everything at once, just the files backed up in a specific snapshot.

Restic seems to be aware of all directories, not just ones in the latest backup, because if I change a single file in both directories then restic backup /foo notes one file modified, restic backup /bar notes one file modified, then restic backup /foo notes no files modified.

If the snapshot created when backing up /bar “replaced” the content of the initial backup of /foo I would expect it to say 1 changed again.

On the backup side my method seems to be working fine and restic understands but I just can’t figure out how to restore after using it. I would really appreciate if anyone could clear this up for me!

Thank you so much for your time!

First, use the restic snapshots command to find out the snap_id of the snapshot you need. And then, to get a list of files in this snapshot, use restic ls snap_id.
The latest command always substitutes the snap_id of the most recent snapshot in the repository.

Restic does not support restoring everything at once for a variety of reasons such as how to decide which snapshot is the “latest” of a series that have different tags, host names, root paths etc. One way to browse the entire repository is to use the restic mount command, which offers a way to navigate all snapshots via several different grouping methods.

Restic doesn’t replace any data, it only adds data, until one runs a restic forget. Some of the summary of changes are in relation to the “parent snapshot”, however the bytes added is precise. Running a backup of /foo will try to find the most recent backup with the root path of only /foo with similar metadata. The “files changed” summary is relative to this parent. It’s possible a parent isn’t found in which case a backup run might suggest all files are “new” and still list only a small amount of added bytes.
https://restic.readthedocs.io/en/latest/040_backup.html#file-change-detection

2 Likes