Help Removing snapshots according to a policy

I make backup copies at irregular periods and I want to keep them following the policy:

keep the last two
keep daily snapshots for the last week
keep weekly for the last month
keep monthly for the last year
keep yearly for the last 2 years

I understand that I would have to execute the following command:

restic -r /“BACKUP LOCATION” forget --keep-last 2 --keep-within-daily 7d --keep-within-weekly 1m --keep-within-monthly 1y --keep-within-yearly 2y

But restic shows the following:

unknown flag: --keep-within-daily
unknown flag: --keep-within-weekly
unknown flag: --keep-within-monthly
unknown flag: --keep-within-yearly

Do these parameters no longer exist?

How can I implement the conservation policy I want?

I have followed what is in the documentation:

https://restic.readthedocs.io/en/latest/060_forget.html#removing-snapshots-according-to-a-policy

“You might want to maintain the same policy as in the example above, but have irregular backups. For example, the 7 snapshots specified with --keep-daily 7 might be spread over a longer period. If what you want is to keep daily snapshots for the last week, weekly for the last month, monthly for the last year and yearly for the last 75 years, you can instead specify forget --keep-within-daily 7d --keep- within-weekly 1m --keep-within-monthly 1y --keep-within-yearly 75y (note that 1w is not a recognized duration, so you will have to specify 7d instead).”

1 Like

I think you forgot restic command forget

restic -r /“BACKUP LOCATION” forget --keep-last 2 --keep-within-daily 7d ...

1 Like

Forget to put forget in the message not in the command. Corrected the post

1 Like

And what is your restic version?

restic version

1 Like

restic 0.9.6 compiled with go1.12.12 on linux/amd64.

I installed it with Linux Software Manager Min 20.3

1 Like

This is ancient restic version from 2019…

You have two options:

  1. Use documentation and features available for your restic version - Restic Documentation — restic 0.9.6 documentation

  2. Update your restic to the latest version v0.16 and enjoy all features like --keep-within-daily

1 Like

Thanks, I updated to the latest version sudo restic self-update

Do I have a problem if the old copies were created with version 0.9.6 and the new ones with version 0.16?

1 Like

Nope. All should work without any issues.

You might consider upgrading repository format - it will allow you to use data compression.

Have a look at this thread:

More details in docs - Working with repositories — restic 0.16.0 documentation

1 Like

I want something simple, this is complicated and I don’t understand English well .

I have to execute:

  1. migrate upgrade_repo_v2

2.prune

  1. prune --repack-uncompressed

Can you confirm?

1 Like

:grinning:

Run:

  1. restic migrate upgrade_repo_v2
  2. restic prune --repack-uncompressed
    imply --compression auto - fast but worse compression level
    or
    restic prune --repack-uncompressed --compression max

Thank you so much

One last question and sorry for the inconvenience.

Could you help me in this thread?

https://forum.restic.net/t/how-to-limit-restoration-speed/6711

When I restore a snapshot the computer cannot be used, it is very very slow, I do not think it is a problem with the CPU since it is a fast computer, nor with the 16 GB RAM, I think it is due to the disk writing speed that saturates it