diff options
author | Peter Hoeg <peter@speartail.com> | 2017-02-12 23:04:01 +0800 |
---|---|---|
committer | Peter Hoeg <peter@hoeg.com> | 2017-10-14 14:38:04 +0800 |
commit | 41306ca50580d66591058211676c463fcb30a2fd (patch) | |
tree | 4f0db2c4a1d4ee60e2b1f9271bb6c83002f9293a | |
parent | 1917e69b546bc357652a3fd888c064e2a1c9fed8 (diff) | |
download | nixpkgs-41306ca50580d66591058211676c463fcb30a2fd.tar nixpkgs-41306ca50580d66591058211676c463fcb30a2fd.tar.gz nixpkgs-41306ca50580d66591058211676c463fcb30a2fd.tar.bz2 nixpkgs-41306ca50580d66591058211676c463fcb30a2fd.tar.lz nixpkgs-41306ca50580d66591058211676c463fcb30a2fd.tar.xz nixpkgs-41306ca50580d66591058211676c463fcb30a2fd.tar.zst nixpkgs-41306ca50580d66591058211676c463fcb30a2fd.zip |
smartd: set drive timeout
-rw-r--r-- | nixos/modules/services/monitoring/smartd.nix | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/nixos/modules/services/monitoring/smartd.nix b/nixos/modules/services/monitoring/smartd.nix index 4d10299a987..5dcd99a1e71 100644 --- a/nixos/modules/services/monitoring/smartd.nix +++ b/nixos/modules/services/monitoring/smartd.nix @@ -81,13 +81,32 @@ let description = "Options that determine how smartd monitors the device."; }; + timeout = mkOption { + default = -1; + example = "70"; + type = types.int; + description = '' + Set SCT Error Recovery Control timeout in deciseconds for use in raid configurations. + + Values are as follows: + -1 = do not touch, leave at default + 0 = disable SCT ERT + 70 = default in consumer drives (7 seconds) + + Maximum is disk dependant but probably 60 seconds. + ''; + }; + }; }; -in + deviceTimeout = d: + lib.optionalString (d.timeout > -1) '' + ${pkgs.smartmontools}/bin/smartctl -l scterc,${d.timeout},${d.timeout} --silent errorsonly ${d.device} + ''; -{ +in { ###### interface options = { @@ -222,7 +241,13 @@ in path = [ pkgs.nettools ]; # for hostname and dnsdomanname calls in smartd - serviceConfig.ExecStart = "${pkgs.smartmontools}/sbin/smartd --no-fork --configfile=${smartdConf}"; + serviceConfig = { + ExecStartPre = '' + ${concatMapStringsSep "\n" deviceTimeout cfg.devices} + ''; + ExecStart = "${pkgs.smartmontools}/sbin/smartd --no-fork --configfile=${smartdConf}"; + }; + }; }; |