Thomas' Tech Tips

See size of each snapshot in restic backup repository

16 June 2023 - Thomas Damgaard

I recently noticed that a restic backup repository had suddenly exploded in size going from a bit over a TB to several hundred GBs over that to just over 2 TB. The odd thing was that the source files had not changed in size.

I take daily backups but I was not sure exactly when this happened other than it was recently.

I figured that maybe my cleanup wasn’t working properly, so I checked the snapshots:

restic -r $RESTIC_REPO snapshots

This gave med the expected list of snapshots with my cleanup policy clearly applied.

So I wanted to figure out how much disk usage each snapshot contributed. But since restic uses de-duplication, this is not as simple as running du.

I found out that restic has a idiff command that can be used. The diff command shows the difference in contents between two snapshots. Adding -v option shows size of data added and removed between two given versions.

restic -r restic diff -v <snapshot_id_1>  <snapshot_id_2>

Example output:

Files:       56651 new, 36981 removed,  4814 changed
Dirs:         4586 new,  4227 removed
Others:        253 new,   236 removed
Data Blobs:  72841 new, 45100 removed
Tree Blobs:  11825 new, 11443 removed
  Added:   68.860 GiB
  Removed: 51.110 GiB
Filed under: backup, howto, linux, restic, storage, tips

Back to article list