Questions about prune options

Hello,

I have a couple of questions about how duplicacy prune works cause it is not clear from the --help.

  1. When I run duplicacy prune -keep 30:30 then it will remove all snapshots that are older than 30 days except one for each 30days period, sure. But what about snapshots newer than 30 days? Will they be removed or kept as is?

  2. What happens when I run -keep together with -a? Let’s say I have one revision in snapshot ID 1 then is 30+ days old, and one in snapshot ID 2 also 30+ days old, and I use -a -keep 1:30. Will this keep one revision per snapshot ID or will one of these get removed?

  3. Which revisions are kept by -keep oldest ones or newest ones? What I mean by that is let’s imagine, that I have run backup every day for a whole year 2023. So I have 365 revisions and I run duplicacy prune -keep 31:31 on new year 01.01.2024. Which revisions will be kept?

01.01.2023
01.02.2023
04.03.2023

or


29.09.2023
30.10.2023
30.11.2023

  1. How can I delete a snapshot ID completely? Let’s say I have two machines and I assign each one different snapshot ID. But later I get rid of the second machine so it will never run any backups again and I don’t need its snapshots anymore. But the snapshots are still in the backup. Can I remove them including the very last one? Is it safe, and if so, how? I don’t see anything like duplicacy prune -id ID -delete_completely

  2. Similar to no 4 above. Can I rename snapshot ID? If so, how?

Kept as-is.

Running -a along with -keep is desired. You normally wanna prune an entire storage, not just the snapshot ID being run on.

Are you talking about separate snapshot IDs? If so, they’re unconnected with each other. If you’ve only got 1 revision per snapshot ID, no revisions will get removed because Duplicacy will always keep the most recent revision regardless of -keep.

The oldest revisions are iterated on first, and tested against the -keep <n:m> rules. In your scenario, I believe all of those revisions will be kept - not either-or, plus all the day revisions in December 2023. Why not write a script to test a given retention period?

The easiest method would be delete the corresponding snapshot/<id> directory on the storage.

Otherwise, you will have to run a prune -id <ID> -r <revision(s)> for each revision that exists there. You’ll also have to add the -exclusive flag on the most recent revision, as that is normally protected. Note you should never run -exclusive simultaneously with any other jobs on the same storage.

Why not write a script to test a given retention period?

I ended up writing a script and running my own experiments to get answers.

In your scenario, I believe all of those revisions will be kept - not either-or

That cannot be true. You misunderstood my question - that is my fault, my example was misleading apparently.


And here are the answers:

  1. -keep removes snapshots older than m days, and the ones younger stay as is

  2. Snapshot IDs are completely independent. So -keep really means: “keep 1 snapshot every n days for each snapshot ID …”

  3. -keep keeps the oldest revisions and removes snapshots going from oldest to newest. That means, that revisions left will be:

2023-01-01
2023-02-01
2023-03-04
2023-04-04
2023-05-05
2023-06-05
2023-07-06
2023-08-06
2023-09-06
2023-10-07
2023-11-07

and not

2023-01-24
2023-02-24
2023-03-27
2023-04-27
2023-05-28
2023-06-28
2023-07-29
2023-08-29
2023-09-29
2023-10-30
2023-11-30

4 + 5. There is no command to rename or delete snapshots. And I would not recommend running prune -exclusive to remove last revision in this case. From my experiments looks like it is safe to simply rename the directory (or completely remove it) on the storage backend side. It didn’t break anything (list, restore, etc) for me.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.