Snapshot stats with file granularity

This is probably a simple question but I can’t find the answer anywhere, sorry.

The restic diff command lists individual files, and prints a total size at the end. But I can’t figure out how to attribute that total to individual files. The question I’m trying to answer is: if a snapshot added 10GB to the repo, what specific files are responsible for that 10GB?

This simple question is nearly impossible to answer due to deduplication. For example, a snapshot adds to large, but identical files. Now neither of the is responsible for the added data as deleting the “responsible” file wouldn’t remove the data. But it would be possible to calculate some simpler replacement that might be good enough. diff could report how much data in a file has changed compared the other snapshot. That would report the added data for both files in my example, but might be good enough to check for size differences.

So far diff doesn’t calculate such information, but feel free to open a feature request.

You can get that info during the backup if you enable JSON output (and verbose output, I think). I use --json -v --no-scan

If message_type == "verbose_status" you can check the item and data_size fields. data_size is the amount of data that had to be uploaded for backing up that file. (Experts, please correct me if that is not fully correct.) However, I don’t know whether it is before or after compression. (I have not checked, my guess is before compression.)