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
Destructive rotations #33
Comments
I think the
Weekly/higher level rotations will also fail to rotate because there is nothing to rotate if lower levels fails |
It is not that simple :( Example: 7 daily backups, 4 weekly backups. Backup is done every day (just after midnigt) using && daily rotation, then cron is set to do weekly rotation every monday. (Notation: backup symbols represent calendar date of their creation = mtime of backup directory. The first is newest. Number is calendar number of the week. The first group are daily backups, the second are weekly backups.)
So far everything as expected. Lets get unlucky next week, using current implementation (with sync && daily):
Now there is only 6 days between first and second weekly backup. Let's go back to day 8 and use real-time based implementation instead (weekly rotation is done after the daily rotation):
Now all weekly backups are nicely in 7 day interval. Maybe I should write a script to calculate some more interesting examples. |
Hey, revisiting this since it was referenced from a new issue. Just wanted to note the
You would do the opposite. I.e not use sync && rotate, but just always rotate. This gives rise to other issues of course. Specifically you'll have places in your chain where say alpha.N is exactly the same image as alpha.N+1.
Think its a big change. My preference right now is KISS. |
Here is little example, the ls of my current backups.
I'm using the script from the issue description, symlinks are updated automatically. Note that I was away for a few days and the latest backup was yesterday when I returned, but no rotations were made when I was away. The time-based rotations are just different algorithm to decide what to rotate. Backward compatibility must be preserved for current users (so option to enable them is required), but otherwise, it should not complicate stuff too much. |
New rsnapshot user here. I'm glad I looked through the bug reports, because this is pretty bad. If the backup fails, snapshots must not be deleted. In other words, rsnapshot should by default sync to a temporary directory first, and rotate afterwards. |
@sam-at-github If you agree I will prepare a pull request to make that the default. Should be a small change as |
Hello,
rsnapshot backup rotations does not take into account, that backup may fail. There should be check how old is the oldest daily backup and rotate the weekly only if the oldest daily is at least week old. When a lot of backups fail, for example when trying to backup a missing laptop, rotations will eventualy delete all old backups, which is definitely wrong (at when cron is used to rotate as recommended in man page).
I use following script to invoke rsnapshot:
I use only daily and weekly backups. When backup fails, daily rotation is not performed. When oldest daily backup is older than 6.5 day (to avoid rounding errors when one day is backup faster than other), weekly rotation is performed.
Goal is to have weekly backups at least 6.5 days from each other.
When there is more daily backups than expected, extra daily backups are rotated away. And next weekly backup is created when the rotated-away backup is old enough.
When daily backups are missing, weekly backup is created earlier than after 7 daily rotations. So if laptop is connected in LAN only once a week, daily backups will be in week interval and each daily backup will become a weekly backup. This will remove too old backups.
Final part of the script creates symlinks with date of backup. Very simple and very practical. But a little bit off topic here.
What do you think about real-time based rotations?
The text was updated successfully, but these errors were encountered: