This is Part '2.5' of my series on building a restic-based system backup series. The rest of the articles can be found here.
You should be reading Part 3 here, but in the development of that, I ran into this restic bug: Unable to backup/restore files/dirs with same name.
Unfortunately, for historic reasons (buried in some of the oldest code in restic),
only the last component of a path being backed up in a restic repository is
reflected in the repo. For example, in my case, when I wanted to back up both
/local
and /usr/local
they would show up as local
at the top of the repo, a very confusing state. Later versions of restic would rename
things so there was a local-0
and a local-1
, etc, but it's
still very confusing.
The primary restic developer is working on resolving this, as many other people
have ran into it, and it is expected to be fixed in restic 0.8. Until then, the
suggestion is to tell restic simply to back up /
, and exclude out
everything you don't want to back up. A workable enough solution, but I still want
something where I can think in terms of backing up what I want, and something else
figures out how to do the exclusion. That way, I can just add or remove things from
my list and I don't have to re-figure what to exclude. Or, things can come and go
that I don't care about, and they won't accidentially get backed up.
A few hours of work and experimentation, and I had restic-unroll, which does just that. In the same directory in that git repo is an example bash script you might wrap things in to do a daily system backup.
As a reminder, you can find the canonical repository of all my utility scripts in this series here