Implications of storing by paths

I’m new here. When I look at a mounted repo I see that it’s organised like hosts/HOSTNAME/absolute/path/file.

Sometimes my data moves around a bit, e.g. the host changes but also the path. I was pretty happy to see the effect of deduplication on this. I created the first backup in the repo from my existing backup server (a simple nightly mirror copy), then I ran a backup from the production machine and even though the paths and hosts were different (paths: /backup/server1/var/www on my backup machine, and /var/www on the prod machine) it ran through quickly because it recognised the data as the same.

However, it leaves me with a path (as shown when mounted) like hosts/oldbackupserver/backup/server1/... that I’m not sure how to delete. I know it’s not taking up much space but it could be confusing later on.

Is there a way to specify a storage path, like you can in rsync (-R from memory) so that two hosts that have the data in two locations could store it in the same place? Feel free to tell me this is not a good idea :slight_smile:

And is there a way to delete unwanted hosts or paths?

Thanks.

Not sure if I understood you correctly but you could just use the forget and prune functions: https://restic.readthedocs.io/en/stable/060_forget.html . That way your initial snapshot would be gone and the files would still exist in all the other snapshots.

1 Like

There’s currently no way to “modify” the path that’s being saved for the items you back up, you’d have to cd into an appropriate base directory and run the backup from there to make it be a relative path that will be the same on all your hosts backing this data up.

If you really want to get rid of it, delete the snapshots. That said I don’t really see the problem.

1 Like

just use the forget and prune functions

yeah right, because each snapshot only belongs to one host… Makes sense, thanks.

Ah, I must have missed the relative paths feature, I’ll go RTM again! Thanks.

It’s not really a feature, it’s just how your position yourself in the filesystem when you run restic and give it paths.

Let’s say you have a directory mysite that on server 1 is placed in the /var/www/ dir and on server 2 is placed in the /data/web/htdocs/ dir.

If you back those up by running e.g. restic backup /var/www/mysite and restic backup /data/web/htdocs/mysite on server 2 you will obviously have snapshots with different paths in them, which you don’t want.

But if you before backing up on each server first cd into the dir where mysite is located, and then run e.g. restic backup mysite then all snapshots will have just mysite as the path.

That’s really helpful, thanks.