Latest snapshot of particular host

Hi,

when I back up several machines to the same repo what is the best way to get the latest snapshot of a particular host (evidently in this scenario the convenient “latest” symlink that restic provides could refer to a snapshot of a different host).

Does restic have an elegant way to figure that out or is it something I need to script myself?

Many thanks!

If one takes the Unix philosophy seriously, this should not be built into restic itself (which it may be - I don’t know). It’s fairly easy:

restic -r repo/ snapshots | grep host | tail -n 1

If you just want the snapshot id:

restic -r repo/ snapshots | grep host | tail -n 1 | cut -d " " -f 1

You can just tell the snapshots command to filter on the host and get the latest snapshot: restic snapshots --host HOSTNAME latest

See restic help snapshots for more information.

2 Likes

restic snapshots --host HOSTNAME latest

2 Likes

I don’t like the inefficiency of this as it takes an extra roundtrip to the repo just to figure out an id which is costly when you use e.g. dropbox.

Oh great. restic is really a fantastic piece of software.

3 Likes