How to configure smartd and be notified of hard disk problems via email -

We will talk about the smartd daemon: we will see how to schedule tests and how to configure it to so to be notified via email when an error is found on a storage device. In the course of the article I will assume the smartmontools package to be already installed. Please refer to the aforementioned article for installation instructions. This is a companion discussion topic for the original entry at

I followed the guide and msmtp is working; however, email alerts from smartd aren’t working. Any advice?

Hi Discipulus,

Welcome to our forums.

Do you see any relevant error messages in the logfiles?

Have the same problem… I can use msmtp from the command line fine. So I know it is setup right with the email account I configured for its use. The /var/log/msmtp.log, only shows the successful test from the command line. It does not appear that smartd even tried to invoke msmtp. The smartd log from systemctl/journalctl shows no errors, only report successful send of mail. So where else should I look for what really happened?

Hi Nodi.Rubrum,

Welcome to our forums.

So your smartd journal shows successful mail send, does that relate to the command line test, or the mail that actually never arrived?

The smartd service reported success, but it was a false report. The mail as never generated or sent. I back-tracked the issue to the fact that mail or mailx was not sending mail to an external source as directed. I installed msmtp, and then rewrote the smartd-runner script to call msmtp correctly and with the correct parameter order that msmtp needs versus the default the smartmontools (smartd) attempts on Debian 10. Not only is smartmontools staged a bit different than other distros (different paths and different dependencies) for Debian via the package creator decision, but deviates from the common use of notification via the runner script.

Ah yes, the beauty of different distros using different paths, package names, config files, service names… The list is long and quite chaotic sometimes.

Mind sharing your smartd-runner script? I can’t seem to get mine running and believe I have the same problem


# cat /usr/share/smartmontools/smartd-runner
#!/bin/bash -e
cat >$tmp
run-parts --report --lsbsysinit --arg=$tmp --arg="$1" \
    --arg="$2" --arg="$3" -- /etc/smartmontools/run.d
rm -f $tmp

Basically mail or mailx use a different command line parameters set, than msmtp, I happen to have msmtp available so just changed the script to be compatible with msmtp.