Skip to content

Add snapper-sync to synchronize the highest snapshot number#1128

Open
jameslai-dev wants to merge 5 commits intoopenSUSE:masterfrom
jameslai-dev:dev_snapper_sync
Open

Add snapper-sync to synchronize the highest snapshot number#1128
jameslai-dev wants to merge 5 commits intoopenSUSE:masterfrom
jameslai-dev:dev_snapper_sync

Conversation

@jameslai-dev
Copy link
Copy Markdown
Contributor

@jameslai-dev jameslai-dev commented Apr 23, 2026

To resolve the potential snapshot number collision after a system restore, as mentioned in #1105 (comment), this pull request adds a snapper-sync script to synchronize the highest snapshot number between the source and the backup target. The script can be triggered automatically by enabling snapper-sync.service.

Detailed changes:

  • Added script/snapper-sync: A script to synchronize the highest snapshot number across snapperd and snbk. This script does nothing if snbk is not installed. The script requires both snapper and snbk to be installed.
  • Added data/snapper-sync.service: An optional systemd service to trigger snapper-sync automatically.
  • Changed data/boot.timer and data/timeline.timer to optionally depend on snapper-sync.service.
  • Changed snapper.spec.in and dist/debian to include snapper-sync related files in the snapper snapper-backup package.
  • Added documentation for snapper-sync in the snapper snapper-backup manual.

@aschnell
Copy link
Copy Markdown
Member

Please move the new files to the snapper-backup package. Only when that is installed the new service makes sense.

@jameslai-dev
Copy link
Copy Markdown
Contributor Author

Thanks for your feedback. The snapper-sync files have been moved to the Snapper Backup package. (I thought it would be weird to make snapper-boot.timer and snapper-timeline.timer depend on a non-existent service, but it seems harmless after testing.)

A few minor changes have been made:

  • Changed snapper-sync to require the snbk binary.
  • Adjusted snapper-sync documentation and moved it to /doc/snbk.xml.in

Please take a look!

@jameslai-dev
Copy link
Copy Markdown
Contributor Author

I just realized there is a drop-in mechanism for overriding an existing service, but I haven't used it before: https://wiki.archlinux.org/title/Systemd#Drop-in_files

Would it be appropriate to include drop-in files in Snapper Backup to override snapper-boot.timer and snapper-timeline.timer?
If this is possible, the Snapper timer units can remain unmodified.

@aschnell
Copy link
Copy Markdown
Member

Yes, drop-in overrides look like a good idea.

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

Successfully merging this pull request may close these issues.

2 participants