Trying to understand retention policies

After each snapshot is taken, kopia will assign retention tag to snapshots and delete snapshots that don’t have any assigned tag.

Tags are assigned as follows:

  • latest-N will be assigned to all snapshots going backwards where the most recent snapshot gets latest-1, previous is latest-2 and so on.

  • hourly-N will be assigned to the latest snapshot within each respective hour, going back no more than M hours where M is defined by --keep-hourly parameter.

For example if you have done snapshots at:

2001-01-01 14:01 - not hourly because 14:30 was the last snapshot of this hour
2001-01-01 14:30 - hourly-2
2001-01-01 15:01 - not hourly because 15:55 was the last snapshot of this hour
2001-01-01 15:02 - not hourly because 15:55 was the last snapshot of this hour
2001-01-01 15:40 - not hourly because 15:55 was the last snapshot of this hour
2001-01-01 15:50 - not hourly because 15:55 was the last snapshot of this hour
2001-01-01 15:55 - hourly-1

Similarly daily-N is assigned to the latest snapshot within each day:

2001-01-01 14:01 - not daily because 15:55 was done the same day
2001-01-01 15:55 - daily-5
2001-01-02 14:01 - daily-4
2001-01-03 15:55 - daily -3
2001-01-04 14:01 - not daily because 15:01 was done the same day
2001-01-04 15:01 - daily-2
2001-01-05 15:55 - daily-1

Same rule applies to weekly, monthly, quarterly and annual retention rules - each of them retains latest snapshot within a given time period up to a defined limit.

Note the limit applies to both count and time, so if you have keep-hourly 48, it will keep no more than 48 hourly snapshots going back no more than 48 hours since the last snapshot.

1 Like