Can we see snapshot sizes?

Computing the size of each snapshot is a very time-consuming process since each tree must be visited to determine how large the snapshot is. Doing this for a list of a hundred snapshots would probably take an hour or so.

2 Likes

Ok, thanks that bit I did not know. Will do with the individual stats then.

I found a solution to find space will be freed if a snapshot were removed.

1- Run restic prune --dry-run
2- Take note of sum ā€œtotal pruneā€ and ā€œunused size after pruneā€
3- Run restic forget snapshotid --prune --dry-run
4- Take note of sum ā€œtotal pruneā€ and ā€œunused size after pruneā€
5- The difference between the sums is the space will be freed if a snapshot were removed.

6 Likes

@fthdgn Thanks for the info!

Should be available easily for all backups made starting with v0.17.0 and later: Store snapshot statistics & print snapshot size by MichaelEischer Ā· Pull Request #4705 Ā· restic/restic Ā· GitHub

1 Like

Wow thatā€™s great news. Is there a timeline for 0.17 already? So far, I ran these four (time consuming) commands after each backup to gather statistics and store them:

  • restic stats --json --mode raw-data
  • restic stats --json --mode raw-data latest
  • restic stats --json --mode restore-size
  • restic stats --json --mode restore-size latest

From these some statistics can be derived but the linked pull request provides much more. Thank you!

1 Like

restic 0.17.0 will still take some time (probably 2 months or more), Iā€™m only halfway through with the planned features.

1 Like

Iā€™m running 0.17.3 but no size column when i use restic snapshots :frowning:
What am i doing wrong?

Edit: Restic changelog for 0.17.0:

The snapshots command now prints the size for snapshots created using this or a future restic version

That explains it.

@FunctionDJ i guess you updated restic but did not make a new backup. This new feature works fine with 0.17.3, albeit that all backups made with prior versions <17.0 will show no data in the size column as there is no data stored in the repository.

Going back to the original question, one can also achieve snapshot size information (ā€œhow much storage my snapshots are takingā€) if you set up metrics monitoring. For example with Prometheus and a Grafana dashboard.
There are various tools who can help with that, including rest-server. Some solutions are already discussed on this forum:

Then you can get something like this example, the npbackup dashboard:

p.s. Also metrics monitoring will not generate/show data for backups made in the past.