-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
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
nixos/btrbk: add snapshotOnly option #369480
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you please add btrbk(1)
to doc/manpage-urls.json? Otherwise, looks good to me!
Done! |
Going to wait for @oxalica to look at this, but if they don't get back to you in a week or so you can ping me for a merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going to wait for @oxalica to look at this
I don't have a strong opinion on this. I have a dedicated .conf
for snapshot-only purpose (with a different cleanup policy) so I don't "need" this change personally. But I think it's worth to have option changing the btrbk verb.
@@ -185,6 +185,17 @@ in | |||
Setting it to null disables the timer, thus this instance can only be started manually. | |||
''; | |||
}; | |||
snapshotOnly = mkOption { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This option toggles between "snapshot" and "run" subcommand, thus preventing us from adding/using subcommand other than these two. Will "resume" or "prune" also be helpful in some cases? If so, we should add a "subcommand" option which defaults to "run" instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't think of an example where someone might want to run resume
or prune
as a service. resume
will prune according to the configured retention policy after it's done backing up just like snapshot. You can't only use resume
on its own either since btrbk
compares against snapshots instead of source during the backup stage meaning snapshot
has to have run before to create snapshots that haven't been backed up yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I'm convinced.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't snapshot --preserve
be more "useful to people who use btrbk to send incremental snapshot backups to an external drive"? snapshot
on its own will still delete local snapshots according to the table in https://digint.ch/btrbk/doc/btrbk.1.html. Exposing a subcommand and args list might be more extendable than a single snapshotOnly
attribute.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
snapshot
will delete local snapshots according to snapshot_preserve
and snapshot_preserve_min
which is the same behavior as run
. If you don't want snapshots to be deleted at all you could set snapshot_preserve_min
to all
. Retention policy for backups is configured with target_preserve
and target_preserve_min
. I would assume that people would want their backups to last longer than local snapshots hence they can set different retention policies.
Also, snapshot
will not delete any snapshots that are yet to be backed up to the target despite what the retention policy may imply.
Things done
Added
snapshotOnly
option that is useful to people who use btrbk to send incremental snapshot backups to an external drive. Upstream has this use case documented here.Using
snapshot
subcommand instead ofrun
makes btrbk skip backup creation and deletion steps which can later be run manually withbtrbk resume
. Withrun
, the service would fail if the external drive is not mounted.nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.