Skip-if-unchanged usage

Restic version: restic 0.17.1 compiled with go1.23.2 on darwin/arm64
Restic command: I run this under resticprofile if that makes a difference! This is the output of resticprofile --dry-run backup which shows the restic command. I’ve formatted it for easier reading but this runs on my OSX machine.

/nix/store/0a32cr2vndvzngrkbzy4pw18xa4bnfj6-restic-0.17.1/bin/restic backup \
  --cleanup-cache --exclude-caches \
  --exclude-file=/Users/james/.config/resticprofile/excludes.conf \
  --exclude-if-present=pyvenv.cfg \
  --exclude-if-present=.restic_ignore \
  --exclude-if-present=.restic-ignore \
  --host=james-2023-macbook \
  --skip-if-unchanged /Users/james

First off, thanks for restic! I use it in both my personal life and professional and its never failed me.

I’m trying out the new --skip-if-unchanged setting and I think I’m running in to what the docs mention about metadata of the parent path changing, to quote the docs:

Note that when using absolute paths to specify the backup source, then also changes to the parent folders result in a changed snapshot. For example, a backup of /home/user/work will create a new snapshot if the metadata of either /, /home or /home/user change. To avoid this problem run restic from the corresponding folder and use relative paths.

I’m thinking this as I have a few snapshots where there are zero files or dirs changing but a snapshot is still created, for example:

comparing snapshot ff43cee8 to 7e0f37fa:

[0:01] 100.00%  518 / 518 index files loaded

Files:           0 new,     0 removed,     0 changed
Dirs:            0 new,     0 removed
Others:          0 new,     0 removed
Data Blobs:      0 new,     0 removed
Tree Blobs:     31 new,    31 removed
  Added:   114.146 KiB
  Removed: 114.153 KiB

Is it safe to assume this is the case and if I moved my backups to have a current working directory of /Users/james/ and just backing up . Restic would’ve skipped that backup?

I take a backup hourly and currently have 9,514 snapshots (pruning hasn’t been a requirement for me yet!). I’m not seeing any performance issues at the moment but would love to not create a snapshot if it isn’t required.

Thanks in advance!

That more changed tree blobs than expected. If you backup /Users/james and nothing within that folder has changed, then there should be at most two changed tree blobs. One for /Users and one for /Users/james.

To find out what is the difference you can compare the raw tree data:

diff <(restic cat tree ff43cee8:/ ) <(restic cat tree 7e0f37fa:/ )

Recurse into subfolders if necessary

diff <(restic cat tree ff43cee8:/Users ) <(restic cat tree 7e0f37fa:/Users )
1 Like