Help with pruning schedule

I am wanting to do the following pruning schedule:

  1. Anything older than a year: delete
  2. Anything between 6m-1y: keep one per month
  3. Don’t prune anything between 3m-6m
  4. Anything older than 1m: keep one per week
  5. Keep one backup per day for up to a month (backups are on a daily schedule, so there won’t be more than one a day)

The reason I am wanting to keep everything between 3m-6m is I plan on using S3 object lifecycles to send any backups 3m+ to glacier instant retrieval (GIR). GIR charges for every object up to 90 days. So if I do any pruning in the first 90 days of sending backups to GIR, I have to pay for that storage anyway.

Would the following corresponding rules do what I expect it to?

  1. -keep 0:366
  2. -keep 30:180
  3. no prune rule to keep everything
  4. -keep 7:30
  5. no prune rule to keep everything up to a month

I mostly want to make sure that at 3 months when I move things to GIR, no pruning happens to backups between 3 months and 6 months old.

Yes, looks about right.

-a -keep 0:365 -keep 30:180 -keep 7:30 -keep 1:1

The “don’t prune anything between a month and a year” is taken care by and equivalent to “keep one every week after one month” — because there will no new revisions appear, none will be deleted in addition to the existing matching rule 7:30

You can always add -dry-run flag to experiment to see what would happen with various flags.

I don’t currently have any backups older than a couple of weeks. Still early in my exploratory phase, so testing a dry-run isn’t going to help me much, unfortunately :frowning_face:

Any reason that the -keep 1:1 is required? I assumed that if there is no rule for anything shorter than a month, it implicitly keeps all backups until a rule applies to it?

It’s not required. It’s to satisfy this requirement:

in case you will take more than one backup a day.

1 Like