diff options
author | Franz Pletz <fpletz@fnordicwalking.de> | 2024-05-10 02:11:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-10 02:11:13 +0200 |
commit | 338a208e7dfc086cc25d1d8d36dd646b5fd1f4c0 (patch) | |
tree | 2dda779437243c2aede1bd55562ebbc1bf36bb7b /nixos | |
parent | 7c520d4070f8864309774b943049dcefb7cf65ae (diff) | |
parent | 8e0e9bdee874c3a3cdb50100f93f99c98ac7a7c6 (diff) |
Merge pull request #287505 from jpds/zfs-scrub-trim-randomizedDelaySec
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/tasks/filesystems/zfs.nix | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/nixos/modules/tasks/filesystems/zfs.nix b/nixos/modules/tasks/filesystems/zfs.nix index 9d65319f348d1..b75817a011cbd 100644 --- a/nixos/modules/tasks/filesystems/zfs.nix +++ b/nixos/modules/tasks/filesystems/zfs.nix @@ -441,6 +441,18 @@ in {manpage}`systemd.time(7)`. ''; }; + + randomizedDelaySec = mkOption { + default = "6h"; + type = types.str; + example = "12h"; + description = '' + Add a randomized delay before each ZFS trim. + The delay will be chosen between zero and this value. + This value must be a time span in the format specified by + {manpage}`systemd.time(7)` + ''; + }; }; services.zfs.autoScrub = { @@ -456,6 +468,18 @@ in ''; }; + randomizedDelaySec = mkOption { + default = "6h"; + type = types.str; + example = "12h"; + description = '' + Add a randomized delay before each ZFS autoscrub. + The delay will be chosen between zero and this value. + This value must be a time span in the format specified by + {manpage}`systemd.time(7)` + ''; + }; + pools = mkOption { default = []; type = types.listOf types.str; @@ -862,6 +886,7 @@ in timerConfig = { OnCalendar = cfgScrub.interval; Persistent = "yes"; + RandomizedDelaySec = cfgScrub.randomizedDelaySec; }; }; }) @@ -879,7 +904,10 @@ in serviceConfig.ExecStart = "${pkgs.runtimeShell} -c 'for pool in $(zpool list -H -o name); do zpool trim $pool; done || true' "; }; - systemd.timers.zpool-trim.timerConfig.Persistent = "yes"; + systemd.timers.zpool-trim.timerConfig = { + Persistent = "yes"; + RandomizedDelaySec = cfgTrim.randomizedDelaySec; + }; }) ]; } |