Jump to content

smartmontools

From NixOS Wiki
Revision as of 08:20, 8 October 2025 by Ardenet (talk | contribs) (Created page with "== 定位设备 ==")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

警告:顯示標題「smartmontools」覆蓋了之前的顯示標題「Smartmontools」。

smartmontools is a package which provides tools for monitoring drives which support the S.M.A.R.T. system for monitoring hard drive health.

It includes the smartd and smartctl programs. smartd can be enabled on NixOS systems with the services.smartd module.

定位設備

由於設備節點是任意的且可能會發生變化,因此使用持久的磁盤標識方法非常重要。以下命令將打印存儲設備及其所包含的分區列表。配置 smartd 時,應使用不帶「-partX」後綴的條目,因為它們指的是整個磁盤。

ls /dev/disk/by-id/

Example

❄︎ /etc/nixos/configuration.nix
{
  services.smartd = {
    enable = true;
    devices = [
      {
        device = "/dev/disk/by-id/ata-WDC-XXXXXX-XXXXXX"; # FIXME: Change this to your actual disk
      }
    ];
  };
}