What are parent snapshots?

Hi,

I noticed that the backup subcommand has a --parent flag. I was experimenting setting different parents, but I can’t see the difference in the created snapshots besides that the specified or auto-detected snapshot is listed as parent. What’s the purpose of chaining snapshots together like this?

Thanks!
-chressie

Great question, thanks for asking. A parent snapshot in restic terminology is only used during backup. For an initial backup, restic needs to open and read all files that are to be saved, that’s unavoidable. But for a subsequent backup, restic tries to find a parent snapshot and then loads the metadata which was saved for that snapshot to check if files have been modified. Only modified files are read (and deduplicated) again, whereas for unmodified files restic just takes the contents the previous (“parent”) snapshot recorded. That’s much more efficient.

There’s also the --force option for the backup command which instructs restic to not use any parent snapshot at all and re-read all files.

1 Like

That makes a lot of sense! Thanks for the quick reply and the detailed answer.

Hmm, I just noticed that my (large, remote) repo is using two variations of the ‘host’ name for my mac. Presumably my home router or ISP DNS is doing this. Due to the different hosts, restic is choosing an older (and presumably less optimal) “parent” snapshot. Should I be concerned about this? Is there a way specify the hostname during backup?

Presumably this will have no impact on space usage, thanks to de-duplication. But I wonder if perhaps this will lead to longer/slower backups due to out of date indices being used.

FWIW, for home machines I think it’s fairly common to have unstable hostnames. In my case, my machine gets a different hostname based on whether it’s using WiFi or wired ethernet, even on the same router. I had solved that in the past, but whatever I did seems to have gotten lost over a few MacOS upgrades.

If the host name does not match exactly that’s not a huge issue: restic will just read all data again, but then discover that the data is already saved (due to the deduplication), so it’s not a big deal.

In order to handle unstable hostnames, the backup command takes the option --hostname to set a stable hostanme manually. Did discover and/or try that yet?

1 Like

Ah, that’s a perfect solution, thank you.

I did check the manual at https://restic.readthedocs.io/en/latest/manual.html for such a flag, but only found it discussed there in reference to the “forget” command. I neglected to check the internal “help backup”, which spells it out clearly. Thanks!