-
-
Notifications
You must be signed in to change notification settings - Fork 15.3k
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/zfs: only enable trim if zfs is enabled #70601
Conversation
Also don't fail the service if there are no pools yet. This might happen on installation ISOs.
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.
Tested that zpool-trim.service is now not started on my non-ZFS systems. Thanks!
Note that this makes the logic for zpool-trim different than the one implemented for the other ZFS services in that file. For example, enableZfs
is defined to be enabled if inuse || enableAutoSnapshots || enableAutoScrub
, without taking zpool-trim into account. IMHO enableAutoSnapshots
and enableAutoScrub
should be removed from the enableZfs
boolean, but I don't have a clear understanding of the consequences or how much it would break.
script = '' | ||
zpool list -H -o name | xargs -n1 zpool trim | ||
''; | ||
ExecStart = "${pkgs.runtimeShell} -c 'zpool list -H -o name | xargs --no-run-if-empty -n1 zpool trim'"; |
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.
Should be serviceConfig.ExecStart.
Since we only have a single pipe we can save the overhead of building a derivation when creating the zfs trim service file when building the system.
The Autosnapshot/autoscrub services are now only enabled if |
This makes them consistent with the way zfs.trim is enabled and allow to enable them by default in future.
nixos/zfs: only enable trim if zfs is enabled (cherry picked from commit d633ec9)
nixos/zfs: only enable trim if zfs is enabled
Also don't fail the service if there are no pools yet.
This might happen on installation ISOs.
See also: #69672 (comment)
cc @delroth
This has been not tested yet.
Motivation for this change
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nix-review --run "nix-review wip"
./result/bin/
)nix path-info -S
before and after)Notify maintainers
cc @