garethgeorge / backrest

Backrest is a web UI and orchestrator for restic backup.
GNU General Public License v3.0
787 stars 31 forks source link

Retention Policy keeps wrong daily backup? #330

Closed malavolti closed 4 days ago

malavolti commented 3 weeks ago

Describe the bug

I'm using TZ=Europe/Rome and the following Backrestic plan:

{
  "id": "immich-data",
  "repo": "restic-backup",
  "paths": [
    "/immich-data"
  ],
  "excludes": [],
  "iexcludes": [],
  "retention": {
    "policyTimeBucketed": {
      "yearly": 1,
      "monthly": 6,
      "weekly": 4,
      "daily": 7,
      "hourly": 24
    }
  },
  "schedule": {
    "cron": "0 * * * *"
  }
}

But the "daily" backup saved is not the last one (23:00), but the second (01:00) of the day.

Marco-Backrest-wrong-daily-backup

Expected behavior I desire to keep the last daily backup, not the second one.

Platform Info

garethgeorge commented 3 weeks ago

Hmm. Strange. This must be behavior coming from how restic implements forget policies: https://restic.readthedocs.io/en/latest/060_forget.html which I agree can be a bit counter intuitive.

Looking at https://github.com/restic/restic/issues/3722 and https://github.com/restic/restic/issues/2233 these could possibly be related? But I'm seeing that the local timezone should be picked up / stored in the snapshot so this may not be a problem for backrest. Deserves more investigation.

garethgeorge commented 2 weeks ago

I'm likely going to close this as won't fix infeasible. It may be something to check with the restic forum about, I suspect this is the intended restic behavior though it might not be intuitive. It's probably not something backrest should try to change.