profiles/common: configure smart to reload on disk insertion

main
Felix Stupp 1 year ago
parent 297551dc95
commit 2d29d980e7
Signed by: zocker
GPG Key ID: 93E1BD26F6B02FB7

@ -10,6 +10,7 @@
}:
let
cfg = config.x-banananetwork.allCommon;
inherit (lib.modules) mkIf;
in
{
@ -146,6 +147,14 @@ in
# so smartd reports them by their /dev/disk/by-id name (https://www.smartmontools.org/ticket/1390#comment:2)
defaults.autodetected = "-d by-id";
};
# TODO upstream with better option for rules
# required because smartd only detects drives when launching
# so the udev rule makes smartd useable with removeable drives
# "restart-or-reload" is required because smartd fails to start if no SMART drive was found
udev.extraRules = mkIf config.services.smartd.enable ''
ACTION=="add|change|move|remove", SUBSYSTEM=="scsi_disk", RUN+="${config.systemd.package}/bin/systemctl --no-block try-reload-or-restart smartd.service"
'';
};
# TODO upstream

Loading…
Cancel
Save