[Borgbackup] Issues understanding prune 'keep' rules

Dan Christensen jdc at uwo.ca
Wed Nov 18 09:15:59 EST 2020


Nils,

You should show the exact command line you used, as well as the precise
time you ran it.  You should also include your borg version (borg -V).
Your time zone might also be relevant.  But I'll work with what you sent
and put my notes in the right-hand column.

On Nov 18, 2020, Nils Blomqvist <dassies at eml.cc> wrote:

> keep-within   3d
> keep-daily    7
> keep-weekly   4
> keep-monthly  6
> keep-yearly   7
> 
> Prune run (on 2020-10-24, after the latest backup):

The behaviour depends on the exact time, but I'll assume it was
immediately after the last backup.  If you had run it a few hours
later, the within 3d rule would not have caught the second archive.

Keeping archive: backup-2020-10-24T10:09:21    within 3d
Keeping archive: backup-2020-10-21T12:45:19    within 3d = 72 hours
Keeping archive: backup-2020-10-19T18:46:34    daily 7
Keeping archive: backup-2020-10-06T16:32:43    daily 7
Keeping archive: backup-2020-08-22T10:34:31    daily 7
Keeping archive: backup-2020-08-13T18:50:32    daily 7
Keeping archive: backup-2020-08-07T09:45:07    daily 7
Keeping archive: backup-2020-08-04T18:05:27    daily 7
Keeping archive: backup-2020-08-03T17:17:32    daily 7
Keeping archive: backup-2020-08-02T11:29:23    weekly 4 [Aug 2 was a Sunday]
Keeping archive: backup-2020-07-29T19:17:17    monthly 6
Keeping archive: backup-2020-07-24T17:01:59    weekly 4
Keeping archive: backup-2020-07-19T08:10:21    weekly 4 [July 19 was a Sunday]
Keeping archive: backup-2020-07-06T17:58:07    weekly 4
Pruning archive: backup-2020-07-05T08:12:26    pruned

I was surprised at first that the July 29 archive was kept, but since
it's the last one in July and wasn't kept by the weekly rule, the
monthly rule catches it.  (Note that July 29 and Aug 2 are in the same
week, since weeks go from Monday to Sunday.)

The July 5 backup is the last in its week, but the weekly rules
are used up.  And it's not the last in its month or year.  So it
is pruned.

The output of "borg help prune" contains the details and there is
also help here:

  https://borgbackup.readthedocs.io/en/stable/usage/prune.html

It would probably be good to extend that example to include the
situation that appeared above...

Everything also looks exactly right for the second run you showed:

> And the second again (5 Nov 2020 14:45:44):

Keeping archive: backup-2020-11-05T14:45:15   within 3d
Keeping archive: backup-2020-10-29T13:40:32   daily 7
Keeping archive: backup-2020-10-28T16:39:12   daily 7
Keeping archive: backup-2020-10-27T15:59:16   daily 7
Keeping archive: backup-2020-10-26T14:14:48   daily 7
Keeping archive: backup-2020-10-24T10:09:21   daily 7
Keeping archive: backup-2020-10-21T12:45:19   daily 7
Keeping archive: backup-2020-10-19T18:46:34   daily 7
Keeping archive: backup-2020-10-06T16:32:43   weekly 4
Keeping archive: backup-2020-08-22T10:34:31   weekly 4
Keeping archive: backup-2020-08-13T18:50:32   weekly 4
Keeping archive: backup-2020-08-07T09:45:07   weekly 4
Pruning archive: backup-2020-08-02T11:29:23   pruned
Keeping archive: backup-2020-07-29T19:17:17   monthly 
Pruning archive: backup-2020-07-24T17:01:59   pruned
Pruning archive: backup-2020-07-19T08:10:21   pruned
Pruning archive: backup-2020-07-06T17:58:07   pruned

Aug 2 pruned, since weekly rules are used up, and it's not the last in
its month or year.  Same for the other three.

Dan


More information about the Borgbackup mailing list