Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retention by count and time period #365

Open
alaw005 opened this issue Jul 1, 2024 · 4 comments
Open

Retention by count and time period #365

alaw005 opened this issue Jul 1, 2024 · 4 comments
Labels
enhancement New feature or request p2

Comments

@alaw005
Copy link

alaw005 commented Jul 1, 2024

If backups run every 10 minutes and retention is set by time period eg with hourly = 24 the immediately previous backup from 10 minutes ago is deleted. I want to keep the last 6 (or x) backups and hourly after that, plus any further day, week, month, year setting.

This could be achieved by allowing rention to be set both by count and by time period at the same time. If retention by count is set to x then that many of the most recent backups would be kept and any additional backups deleted UNLESS those backups would otherwise be kept based on the retention by time period setting. In other words only delete backups that don't meet either retention policy.

@alaw005 alaw005 added the enhancement New feature or request label Jul 1, 2024
@garethgeorge
Copy link
Owner

garethgeorge commented Jul 1, 2024

Interesting, it hadn't ever occurred to me that there's a use case for --keep-last-n and --keep-hourly etc in combination but this makes plenty of sense and support is relatively straightforward to add though it may take me a few versions to get to this. (edit: I'm assuming that you're coming from restic / know that these flags do actually work together -- I'll aim to test when I have some time).

Will track popularity of this FR in the meantime for my prioritization.

@mitchplze
Copy link

+1 for this feature, please.

Right now I can't use Backrest for anything more frequent than hourly backups, as the last ones just get pruned. :(

This command is an example of how I would do it on the cli, keeping all backups incl. ones that run every 15 min:

restic forget --keep-within 24h --keep-daily 90 --prune

@mlusetti
Copy link

First of all thanks, backrest is indeed pretty nice!.
This feature is very useful IMHO, keep-within the keep-last are cover very wide and useful combinations.
I would go even further. I would separate the forget command from the backup one.
Why would you run forget right after backup since forget does not reclaim/free space ?

@raphpa
Copy link

raphpa commented Dec 26, 2024

In addition to this I think the retention policy explanation on the web interface is not correct. It says Snapshots older than the specified time period will be dropped. That would be the --keep-within-hourly --keep-within-daily etc. flags of restic.

However backrest is using the --keep-hourly etc. flags which keep the last x snapshots, only counting them if they exist for that time period.

For example if I specify Hourly: 48, expecting that hourly snapshots older than 48 hours would be dropped, but only do 4 snapshots on a day (separated by more than one hour), it will keep all snapshots for the last 12 days instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request p2
Projects
None yet
Development

No branches or pull requests

5 participants