Does --group-by="host,paths" mean that each snapshot group is a host+path combo, or that snapshots are grouped 1st by host & then by path?

Just wondering the above. For example, let’s say you have 2 machines, MachineA and MachineB, that backup path / to the same repo.

Does --group-by="host,paths" group snapshots as:

  1. MachineA + /
  2. MachineB + /

So that --prune can then run on groups 1 & 2 separately?

That’s what I’d expect; I’m just trying to confirm it.

I just tried to confirm, it separates as you’d like. --keep-last 1 kept one snapshot “per host” for the same path:

./restic_0.12.0_linux_amd64 -r zz forget --group-by="host,paths" --keep-last 1 --dry-run
enter password for repository:
repository b9c2e8f8 opened successfully, password is correct
Applying Policy: keep 1 latest snapshots
keep 1 snapshots:
ID        Time                 Host        Tags        Reasons        Paths
-------------------------------------------------------------------------------------------------------------
b83db91a  2021-04-20 12:29:31  host1                   last snapshot  /home/gurkan/testfolder
-------------------------------------------------------------------------------------------------------------
1 snapshots

keep 1 snapshots:
ID        Time                 Host        Tags        Reasons        Paths
-------------------------------------------------------------------------------------------------------------
8111cf95  2021-04-20 12:29:41  host2                   last snapshot  /home/gurkan/testfolder
-------------------------------------------------------------------------------------------------------------
1 snapshots
1 Like

Perfect, thanks! I wound up using filtering by specified host instead as I want some hosts to have more snapshots than others.

Note that prune can always only run on the whole repository. The reason is, it must first collect all blobs that are still needed by any of the snapshots and can only then remove the others. But about forget you are right.

1 Like

Yep, that’s why I switched to just explicitly specifying the hostname instead in each forget command.