Restic Forget command - always keep latest from host/tag?


#1

Is it possible to ensure that at least one snapshot is kept from each individual host, or tag? I have several machines backing up to the same repository and although it’s unlikely any given machine will not back up for long enough to trigger a pruning of ALL of its data, it’s theoretically possible. Just wondering. Thanks! :slight_smile:


#2

restic forget with policy-based keep flags will refuse to delete all snapshots in a single group. How snapshots are grouped is controlled by the --group-by flag. So, e.g., --group-by host will refuse to delete all snapshots of any particular host.


#3

Ahhh okay, thanks a lot!

I just found that in the documentation. It says:

When forget is run with a policy, restic loads the list of all snapshots, then groups these by host name and list of directories. The grouping options can be set with --group-by , to only group snapshots by paths and tags use --group-by paths,tags . The policy is then applied to each group of snapshots separately. This is a safety feature.

Does that mean it groups by host by default and I don’t need to specify anything if that’s what I want to happen?


#4

restic help forget documents the default:

-g, --group-by string        string for grouping snapshots by host,paths,tags (default "host,paths")