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 not respected? (no forget / prune after period) #446

Open
elegos opened this issue Dec 22, 2024 · 2 comments
Open

Retention not respected? (no forget / prune after period) #446

elegos opened this issue Dec 22, 2024 · 2 comments

Comments

@elegos
Copy link

elegos commented Dec 22, 2024

Hello everyone.

I've used the configuration v2 to setup my restic profile. In particular I have 2 folders that need backup, with different retention policies. An extract of the configuration follows.

groups:
  full:
    profiles:
      - minecraft
      - immich
    continue-on-error: true
    schedules:
      backup:
        after-network-online: true
        at: '03:00'
        permission: 'system'

profiles:
  default:
    repository: "local:/var/backups/helium"
    password-file: "/var/backups/helium.key"

  minecraft:
    inherit: default

    # ...

    retention:
      before-backup: false
      after-backup: true

      keep_daily: 4
      keep_weekly: 0
      keep_monthly: 0

      forget: true
      prune: true

  immich:
    inherit: default

    # ...

    retention:
      keep_daily: 7
      keep_weekly: 4
      keep_monthly: 3

      forget: true
      prune: true

This is the list of snapshots I have:

ID        Time                 Host        Tags        Paths
-------------------------------------------------------------------------------------
30568635  2024-12-08 15:30:53  helium                  /home/gfurlan/docker/minecraft
0217d33a  2024-12-08 16:42:34  helium                  /home/gfurlan/docker/immich
cb26a17c  2024-12-08 17:03:53  helium                  /home/gfurlan/docker/immich
538c22cb  2024-12-08 17:05:04  helium                  /home/gfurlan/docker/minecraft
f00ab26f  2024-12-08 17:05:07  helium                  /home/gfurlan/docker/immich
1c9324f5  2024-12-09 18:40:56  helium                  /home/gfurlan/docker/minecraft
cac1bc88  2024-12-09 18:40:59  helium                  /home/gfurlan/docker/immich
f9c7daf5  2024-12-09 22:55:08  helium                  /home/gfurlan/docker/minecraft
866196d7  2024-12-09 22:55:11  helium                  /home/gfurlan/docker/immich
ee7c8182  2024-12-10 03:00:49  helium                  /home/gfurlan/docker/minecraft
452eddde  2024-12-10 03:00:52  helium                  /home/gfurlan/docker/immich
f299229b  2024-12-11 03:00:49  helium                  /home/gfurlan/docker/minecraft
612ac61e  2024-12-11 03:00:52  helium                  /home/gfurlan/docker/immich
e1eb4d40  2024-12-12 03:00:49  helium                  /home/gfurlan/docker/minecraft
9a7e4d07  2024-12-12 03:00:52  helium                  /home/gfurlan/docker/immich
0b87ec6e  2024-12-13 03:00:49  helium                  /home/gfurlan/docker/minecraft
0f3a5b45  2024-12-13 03:00:52  helium                  /home/gfurlan/docker/immich
ebe8915f  2024-12-14 03:00:49  helium                  /home/gfurlan/docker/minecraft
19a00b87  2024-12-14 03:00:52  helium                  /home/gfurlan/docker/immich
edb54dc6  2024-12-15 03:00:49  helium                  /home/gfurlan/docker/minecraft
d3634ec8  2024-12-15 03:00:52  helium                  /home/gfurlan/docker/immich
7d298e74  2024-12-16 03:00:25  helium                  /home/gfurlan/docker/minecraft
1190c82e  2024-12-16 03:00:27  helium                  /home/gfurlan/docker/immich
c4a8c1d5  2024-12-17 03:00:25  helium                  /home/gfurlan/docker/minecraft
6d16d435  2024-12-17 03:00:27  helium                  /home/gfurlan/docker/immich
3178d0c4  2024-12-18 03:00:19  helium                  /home/gfurlan/docker/minecraft
e58f14cd  2024-12-18 03:00:23  helium                  /home/gfurlan/docker/immich
bbf62437  2024-12-19 03:00:19  helium                  /home/gfurlan/docker/minecraft
295fef74  2024-12-19 03:00:22  helium                  /home/gfurlan/docker/immich
2c3f7733  2024-12-20 03:00:19  helium                  /home/gfurlan/docker/minecraft
67846b43  2024-12-20 03:00:22  helium                  /home/gfurlan/docker/immich
4f231ba3  2024-12-21 03:00:19  helium                  /home/gfurlan/docker/minecraft
3972c864  2024-12-21 03:00:22  helium                  /home/gfurlan/docker/immich
-------------------------------------------------------------------------------------

I expected to only have 4 Minecraft's snapshots, but I see 16 of them. Also the immich's backups should be less (7 dailies, 2 weeklies, 0 monthly (so far)).

Have I misunderstood how to configure retention policies?

Thanks

EDIT:
in the logs, I see the following, as if no retention policy was specified...

dic 22 03:00:11 helium resticprofile[298921]: 2024/12/22 03:00:11 profile 'minecraft': cleaning up repository using retention information
dic 22 03:00:12 helium resticprofile[299142]: no policy was specified, no snapshots will be removed

resticprofile version resticprofile version 0.29.0
restic version 0.13.1

@elegos
Copy link
Author

elegos commented Dec 22, 2024

From a fast review of the code, it seems that profile.retention has been deprecated, and it is suggested to use profile.forget. I'm surprised that a deprecated section is still not used in any case, though after setting up the forget section and running resticprofile with the forget command (i.e. resticprofile --config /var/backups/helium.resticprofile.yml --profile minecraft forget, it removed the old backups.

I'm keeping the issue open until tomorrow, i.e. the next backup & forget nightly schedule.

@elegos
Copy link
Author

elegos commented Dec 23, 2024

The schedule still "forgot" to forget and prune the old backups...

This is the service generated by resticprofile:

[Unit]
Description=resticprofile backup for profile full in ./helium.resticprofile.yml
After=network-online.target

[Service]
Type=notify
WorkingDirectory=/var/backups
ExecStart=/bin/resticprofile --no-prio --no-ansi --config ./helium.resticprofile.yml run-schedule backup@full
Environment="RESTICPROFILE_SCHEDULE_ID=./helium.resticprofile.yml:backup@full"
Environment="HOME=/root"
Environment="SUDO_USER=gfurlan"

I tried to add also forget@full (manually trying sudo resticprofile --no-prio --no-ansi --dry-run --config ./helium.resticprofile.yml run-schedule backup@full forget@full), but the dry-run didn't write about the forget step.

Am I missing anything?

EDIT:
Ok, I've scheduled the 'forget' step separately. Is there a way to concatenate the two actions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant