Keep only the last n versions


I found this related thread and I wonder how I can keep lets say the last 2 versions of a backup in web-ui?


If your backup is at a specific cadence you can tweak -keep arguments to accomplish what you need.

Alternatively, you can write the script described in the linked thread and call it from it to pre-prune script

2 however feels like barely enough for anything.

What is your usecase? Why not keep infinite history?

I will look into your suggestions.

Could you elaborate on how to tweak -keep to accomplish what I want?

I am backing up (among other things) Time Machine backups to Backblaze and only want to keep the last two revisions for storage capacity reasons.

Time Machine itself already is an infinite history of everything to I don’t need Duplicacy to to the same.

For example, if you make a backup once a day, adding -keep 0:2 will result in revisions older than 2 days getting deleted, leaving you with 2. (If you don’t backup for 10 days, there still will be 1 revision kept)

This is very dangerous, please don’t do that. Backblaze recommends that, and even has an article written about it, but it only benefits them: you pay more in storage, but very likely the backup would not be restorable.

  • When you push Time Machine bundle to B2 you are already massively oveusing storage.
  • Extra revisions don’t use much space: each revision only stores new data not present in all previous backups. These differences are negligible compared to the total size of data for most users

Time Machine is great for local restores. not remote. And it does not keep infinite history: Your important data competes for limited space with system data, and number of versions is limited to the space available.

This is very much correct. Don’t backup Time Machine bundle with duplicacy. Instead, backup source data from your Mac directly to B2.

I think I missed to mention that Duplicacy runs on my Raspberry Pi NAS and I only use it to create a cloud backup of my NAS.

I wasn’t aware that Duplicacy shouldn’t be used with Time Machine / sparse bundle images. A lot of people recommend it to backup your NAS to the cloud / B2.

I think if I stick with Duplicacy I will just go the pre-prune script option, should the backups not work for some reason, prune will just wipe my complete history after a while.

These two statements are not mutually exclusive. You can make duplicacy (or any other backup tool; it’s not specific to duplicacy) work with Time Machine bundles, with enough care (for example, at least by ensuring that you only backup a snapshot of the filesystem the bundle is located on, taken when the Time Machine bundle is unmounted, which is really hard to accomplish, but unless you do it – you won’t be able to mount the “backed up” copy) but the end result won’t be worth all the effort. Instead, backup your source data with Duplicacy directly to B2, instead of making a backup of a backup.

Run duplicacy on your Mac, target the same B2 bucket where you backup the rest of the nas.
Duplicaly already supports Time Machine exclusions, so you don’ have to write any exclusion rules, it “just works”. Use reasonable retention rules for prune; for example, you can mimic that of Time Machine. Exclude the Time Machine bundle from the data you backup from a nas.

No it won’t. it will keep at least one backup in each category.