Merge pull request #287505 from jpds/zfs-scrub-trim-randomizedDelaySec
This commit is contained in:
commit
338a208e7d
1 changed files with 29 additions and 1 deletions
|
@ -441,6 +441,18 @@ in
|
||||||
{manpage}`systemd.time(7)`.
|
{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 = {
|
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 {
|
pools = mkOption {
|
||||||
default = [];
|
default = [];
|
||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
|
@ -862,6 +886,7 @@ in
|
||||||
timerConfig = {
|
timerConfig = {
|
||||||
OnCalendar = cfgScrub.interval;
|
OnCalendar = cfgScrub.interval;
|
||||||
Persistent = "yes";
|
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' ";
|
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;
|
||||||
|
};
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue