Converting Synology Snapshot retention policy to Duplicacy Pruning syntax

I apologise in advance, call me an idiot if you like but I have been reading, searching and starting at forums posts for nearly 36 hours now and I just cannot get my head around the pruning.

I don’t know if it’s the wording or what, but it’s just not clicking.

What I would like to achieve is to mirror my synology NAS snapshot retention policy.

It’s currently set up as follows…

Keep the latest snapshot of the day for 30 days
Keep the latest snapshot of the week for 8 weeks (56 days)
Keep the latest snapshot of the month (30 days) for 24 months (730 days)
Keep the latest snapshot of the year for 5 years (1825 days)

My best guess is this…

-keep 365:1825 -keep 30:730 -keep 7:56 -keep 1:30

Is this correct? If not can you please advise the syntax I need?

Also, on the synology, I keep hourly snapshots for 3 days. Is that possible with the prune command? If so, how does it fit in with the hopefully correct syntax written above?

Again, please accept my apologies for being so thick, I have tried.

I am using the Web UI if that makes any difference.

Does this include documentation page here? prune · gilbertchen/duplicacy Wiki · GitHub

-keep 0:1825 -keep 365:730 -keep 30:56 -keep 7:30 -keep 1:3 -a

Assuming you take hourly snapshots. With this command all snapshots younger than 3 days will be untouched.

1 Like

It does yes. I’ve read it over and over again and it’s just not sinking in.

So take for example where you put -keep 7:30.

According to the documentation, that means…

Keep 1 revision every 7 days for revisions older than 30 days

Does that convert to

Keep the latest daily snapshot for 30 days ?

I still don’t understand.

Each keep statement is derived from two of your sequential Synology statements

Keep the latest snapshot of the day for 30 days

So, what we do after 30 days?

Keep the latest snapshot of the week for 8 weeks (56 days)

So we get to keep weekly snapshots after those 30 days. I.e -keep 7:30

You may want to sketch a timeline of what revision you end up with from Synology rules, and then reconstruct corresponding Duplicacy keep rules.

1 Like

Maybe simpler schedule work better? What is the reason you are trying to copy Synology’s one?

This is a good default policy (adapted from macOS Time Machine)

Time Machine automatically makes hourly backups for the past 24 hours, daily backups for the past month, and weekly backups for all previous months.

This translates to:

-keep 7:30 -keep 1:1 -all

This is a good policy for average user data with low turnover.

1 Like

I’m only trying to copy synology’s because I still don’t understand the pruning. I understand easily the rentention box on the Synology, I just can’t get my head around this.

I wanted to have synology’s policy and the matching Duplicacy syntax side by side so I could understand how it correlates, then adjust as required.

So does 7:30 mean that you are keeping a weekly backup, for 30 days?

No. I feel you have not read the documentation linked above. There is exactly this example explained: prune · gilbertchen/duplicacy Wiki · GitHub

Examples:
duplicacy prune -keep 1:7       # Keep a revision per (1) day for revisions older than 7 days
duplicacy prune -keep 7:30      # Keep a revision every 7 days for revisions older than 30 days
duplicacy prune -keep 30:180    # Keep a revision every 30 days for revisions older than 180 days
duplicacy prune -keep 0:360     # Keep no revisions older than 360 days

I am trying to get chatgpt to simplify the syntax for me.

Maybe this is like network subnetting, at first it was like a foreign language, then eventually it just clicked and now I understand it thouroughly.

I think I need visual on this.

Chat gpt? You can’t rely on that. It hallucinates anything remotely nuisanced.

Here is a quote from documentation.

keep <n:m> [+]

Keep 1 revision every n days for revisions older than m days.

Does this sentence make sense?

Think about it this way. The rule only affects revisions older than m days. And it tells at what interval to keep revisions going further to the past (every n days, or n days apart). Until it’s superseded by the next rule, from right to left.

I e -keep 10:100 -keep 5:20 would read (right to left):

Look for all revisions that are older than 20 days, (but younger than 100 days, because for those the next rule will take effect), and keep those 5 days apart, deleting all in between.

Then look for revisions older than 100 days and keep those 10 days apart, deleting all in between

Quiz for a reader:

  1. what do you think will happen if we add another -keep 50:500 in front? Which revisions will this rule apply to and how will it prune them?

    Answer

    it will apply to revisions older than 500 days and keep a revision every 50 days, removing all in between

  2. How about: -keep 0:800?

    Answer

    No revisions will be kept older than 800 days.

1 Like

So,

-keep 0:365 -keep 7:60 -keep 1:14

For revisions older than 2 weeks, but less than 2 months (say a month is 30 days), one 1 revision will be kept? Then for any revision older than 2 months, but less than a year, 7 will be kept. And 0 backups older than a year will be kept.

How does it decide which 1 of the revisions between 2 weeks and 2 months is the one to keep?
And how does it decide which 7 revisions to keep between 2 months and a year??

Ok, lets go back to your original syntax.

-keep 0:1825 -keep 365:730 -keep 30:56 -keep 7:30 -keep 1:3 -a

Let me see if I understand now.

So…

If a revision is older than 3 days, but younger than a month, keep one revision.
If the revision is older than a 30 days, but younger than 56 days, keep 7 revisions.
If the revision is older than 56 days but younger than 2 years, keep 30 revisions.
If the revision is older than 2 years, but younger than 5 years, keep 365 revisions?
If any revisions are 5 years old, delete them.

I hope this is right lol.

ChatGPT’s explanation of your original syntax is as follows…

Keep all backups for the first 5 years (-keep 0:1825).
Keep one backup every year for backups between 2 and 5 years old (-keep 365:730).
Keep one backup every month for backups between 8 weeks and 2 years old (-keep 30:56).
Keep one backup every week for backups between 30 days and 8 weeks old (-keep 7:30).
Keep one backup every day for backups between 3 and 30 days old (-keep 1:3).

Yeah chatgpt’s explanation is different to mine, I guess one of us wrong, or both maybe.

No, a revision every 1 day.

No. a revision every 7 days will be kept.

Corrected version of your write up:

1 Like

Ok, let me have another go…

So, for your original syntax, I’m just going to change the 56 to 60 (2 months) to keep things simple.
So it’s now
-keep 0:1825 -keep 365:730 -keep 30:60 -keep 7:30 -keep 1:3 -a

ANY revisions younger than 3 days old are left untouched.

If a revision is older than 3 days, but younger than a month, keep a revision DAILY, so there would be say 27 revisions to restore from assuming a month is 30 days?

If the revision is older than a 30 days (a month), but younger than 60 days (2 months), a revision every 7 days (weekly) will be kept. (So 4 revisions to restore from)

If the revision is older than 60 days (2 months) but younger than 2 years, keep a revision every 30 days, ie monthly? (So 22 revisions to choose from)

If the revision is older than 2 years, but younger than 5 years, keep a revision every 365 days, ie yearly? So 3 revisions to restore from?

If any revisions are 5 years old, delete them.

You sir have the patience of a saint!

Bingo! This seems correct!

1 Like

Ok I think it’s finally clicked!!

I have written down loads of examples and what they all mean in my personal notes.

Thank you so much for sticking with me and not giving up.

Keep up the good work, I am loving Duplicacy!!

1 Like

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