autorestic icon indicating copy to clipboard operation
autorestic copied to clipboard

Restore latest when using a target backend for multiple servers/source

Open gauth-fr opened this issue 1 year ago • 0 comments

First thanks, i'm new to restic (yesterday) even more to autorestic (today) and it really helps :)

Is your feature request related to a problem? Please describe. I use my S3 backend as target for multiple servers. Those servers may have identical backup location, for example /etc and the location named etc on each server.

Backup is ok (since it's identified by hostname & path in restic), but they all have the same tag (in this example ar:location:etc). The restore latest (so without specifying a specific snapshot id) will restore the latest snpashot with the tag ar:location:etc. So you may end up restoring the /etc directory from server A to server B, which may be unwanted

I tried adding tags on the location, for options > all > tags (not just on backup as i would want it for restore too). I tried on to set it on global, backend and location, but the 2 first may break some restic command since they don't accept --tag. It works for backup, but not for the restore. When the tag is set at the global level, you end up with a restic restore --tag mytag --tag ar:location:etc... , so only the last --tag is working, so still the incorrect latest restored. When tag is set as the backend or location level, it never appear in the CLI.

For now, i just change the location name to be unique across my servers, it works but it's ugly :p

I hope i'm clear enough :)

Describe the solution you'd like I see many ways to achieve that...

  1. when setting options > backup > tags (whatever where, global, backend or location), which will add a tag on a backup, this options > backup > tags should be reused in the restore command, but the different tags should be merged as --tag ar:location:etc,mytag
  2. Change the default ar:location:locname to something like ar:location:hostname:locname (probably the easiest?)
  3. The restic restore accept --hostname to filter on the specified host. BUT, in my case, i overload the default hostname on the backup using location > options > backup > hostname: myhostname, this overridden hostname should be used for the restore :) so maybe a global parameter to overload the default hostname would be useful?
  4. Add a --hostname parameter to autorestic restore that would be passed to restic restore (can be easy too)

There may be other way, but so far it what I was thinking about ^^

gauth-fr avatar Mar 12 '23 19:03 gauth-fr