Time Machine Style Pruning

I have seen several topics on the forum for prune -keep options to mimic other backup systems (Crashplan, Duplicati) but I have not found one for Apple’s Time Machine. Specs detailed here:

… makes hourly backups for the past 24 hours, daily backups for the past month, and weekly backups for all previous months. The oldest backups are deleted when your backup disk is full.

Assuming Duplicacy is set to make hourly backups then the prune -keep would be:

duplicacy prune -keep 7:30 -keep 1:1 -a

Keep a snapshot every

  • 7 days for snapshots older than 30 days (weekly after one month)
  • 1 day for snapshots older than 1 day (daily for up to one month)

Dry run to test:

Running prune command from /path/to/repository
Options: [-log prune -storage test -keep 7:30 -keep 1:1 -a -dry-run

2019-09-07 17:12:00.606 INFO STORAGE_SET Storage set to /path/to/storage
2019-09-07 17:12:02.253 INFO RETENTION_POLICY Keep 1 snapshot every 7 day(s) if older than 30 day(s)`
2019-09-07 17:12:02.253 INFO RETENTION_POLICY Keep 1 snapshot every 1 day(s) if older than 1 day(s)

Not clear to me how to implement the “oldest are deleted when your backup disk is full”.

Hi, I think you nailed the -keep! :clap:

To see how much space is stored for the repository, run Duplicacy Check -tabular and see the last line for the total space used for all snapshots in this repository (i.e. implies -a).

You can remove the oldest revisions by number if you need to remove some. Lowest revision number is the oldest for a particular snapshot ID. Perhaps not use -a in this case. (I think different snapshot IDs might have different revision histories, I mean snapshot X rev 21 might be 2 years old, while snapshot Y rev 21 might be 2 weeks old. Haven’t tested in real life so please correct me if I’m wrong!)

E.g. remove first 5 revisions of the default snapshot:

Duplicacy prune -r 0-4

After this operation, revision 5 would be the oldest revision. This means you probably need to find/know/calculate which revisions to remove, using Duplicacy Check -tabular, or the much less intensive Duplicacy List (which also shows the revision dates but not the space taken).

I don’t think this is possible with :d: builtin features, as it is not aware of storage size. What you should do is set for how long you want to keep the oldest backup, and use that -keep option.