Monitor S.M.A.R.T. Status on macOS Home Server

with smartmontools

Install smartmontools with Homebrew:

$ brew install smartmontools

Edit smartd.conf, comment out everything and add your configs, example:

/dev/disk0 -R 5! -m [email protected]
/dev/disk1 -R 5! -m [email protected]

Which means monitor disk0 and disk1, send an email to [email protected] when any error occurs or when "Reallocated Sector Count" changes. Note that DEVICESCAN doesn't work on my Hackintosh. Make sure you test smartd in debug mode before deploying. Look up the documentation for details.

Add a plist file org.smartmontools.smartd.plist to /Library/LaunchDaemons with content to launch smartd on startup:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <dict>
        <key>Label</key>
        <string>org.smartmontools.smartd</string>
        <key>RunAtLoad</key>
        <true/>
        <key>KeepAlive</key>
        <true/>
        <key>ProgramArguments</key>
        <array>
            <string>/usr/local/bin/smartd</string>
            <string>-n</string>
        </array>
        <key>LowPriorityIO</key>
        <true/>
        <key>WatchPaths</key>
        <array>
            <string>/usr/local/etc/smartd.conf</string>
        </array>
    </dict>
</plist>

The default interval is 30 minutes, it can be changed with -i option.

You'll receive an email from [user]@[hostname].localdomain if there's an error.

P.S. macOS does not support diagnosing external drives with S.M.A.R.T. technology. A driver is needed for external drives.

Some rights reserved
Except where otherwise noted, content on this page is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International license