Merge pull request #287505 from jpds/zfs-scrub-trim-randomizedDelaySec

Changed files
+29 -1
nixos
modules
tasks
filesystems
+29 -1
nixos/modules/tasks/filesystems/zfs.nix
···
{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 = {
···
description = ''
Systemd calendar expression when to scrub ZFS pools. See
{manpage}`systemd.time(7)`.
+
'';
+
};
+
+
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)`
'';
};
···
timerConfig = {
OnCalendar = cfgScrub.interval;
Persistent = "yes";
+
RandomizedDelaySec = cfgScrub.randomizedDelaySec;
};
};
})
···
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;
+
};
})
];
}