Get Ubuntu SMART Disk Warnings by Email with smartd

Use Ubuntu’s smartmontools package to monitor supported drives with smartd, then route its warnings through a working local mail service or SMTP relay. For one Ubuntu server, keep the alert path simple: confirm that smartctl can read each disk, add a recipient to /etc/smartd.conf, and send a test message before relying on alerts. SMART warnings can reveal some developing problems, but they cannot predict every sudden drive failure.

Ubuntu terminal showing smartctl --scan-open discovering a SATA disk and an NVMe device
Example device scan: use the paths and device types returned by your own system.

Choose the email route that fits your Ubuntu host

smartd does not authenticate to an internet mail provider by itself. Its default mail path invokes the system mail command, so email delivery also depends on a configured Mail Transfer Agent (MTA) or relay. Pick the route that matches what is already available:

RouteBest fitPractical trade-off
Existing local MTAA server that already sends system mailFewest new settings; confirm that mail is installed and external delivery works.
Postfix with an authenticated SMTP relayA VPS or home server that needs outbound email through a providerUses the normal system mail path and can queue mail for delivery; needs one-time relay, TLS, and credential configuration.
Lightweight SMTP clientA small host with low email volume and an administrator comfortable managing a client profileSmaller mail stack, but smartd may need a custom -M exec mailer if the client does not provide the mail command.

For a single-drive machine that already has working system mail, use the existing MTA. If this is a new Ubuntu server and you have SMTP relay credentials, Postfix is a practical fit because Ubuntu documents its smarthost setup. A lightweight client such as msmtp is available in Ubuntu’s package archive, but check how it integrates with the mail command expected by your smartd configuration before choosing it. In every case, test delivery to the same external address you plan to monitor.

1. Confirm Ubuntu can read the drive’s SMART data

Install smartmontools and scan for devices that the current system can open:

sudo apt update
sudo apt install smartmontools
sudo smartctl --scan-open

The scan may return entries such as /dev/sda -d sat or an NVMe device path. Use the path and any -d device-type option shown on your machine. Then inspect one drive:

sudo smartctl -a /dev/sda

Change /dev/sda to the discovered device. A USB enclosure, hardware RAID controller, or storage adapter can block SMART passthrough; if the scan does not show a disk, check its controller documentation and the smartmontools device-type options. A successful scan only confirms that data is readable, not that the drive is healthy.

Ubuntu terminal running smartctl health check with an illustrative PASSED status for a SATA disk
Example health output for one drive; a PASSED result is useful but does not guarantee that the device will not fail.

2. Configure smartd to email a recipient

Open the daemon configuration:

sudoedit /etc/smartd.conf

For automatic discovery, use one active scan line, replacing the example address with your destination:

DEVICESCAN -a -m admin@example.net -M test

-a enables the standard set of SMART checks, -m sets the email recipient, and -M test asks smartd to send one test warning when it starts. DEVICESCAN applies these directives to detected drives and ignores later device entries in the file. If you want only selected drives, use a device line for each disk instead, for example /dev/sda -a -m admin@example.net -M test. For RAID or USB-attached disks, include the device-type option shown by your scan or required by the controller.

Nano editor displaying a smartd.conf DEVICESCAN line with an email recipient and test directive
The configuration line enables SMART checks and requests a one-time test message at daemon startup.

Save the file, then enable and restart Ubuntu’s smartmontools service:

sudo systemctl enable --now smartmontools.service
sudo systemctl restart smartmontools.service

Check the service and recent log messages if it does not start cleanly:

systemctl status smartmontools.service
sudo journalctl -u smartmontools.service -n 50 --no-pager

Unit names can vary on older or customized installations; use systemctl list-unit-files '*smart*' to find the unit installed on your system.

3. Test delivery, then choose the reminder behavior

Because -M test sends its message on startup, restart the service and confirm that the email arrives. This verifies the path from smartd through the local mail command and MTA or relay. If the test does not arrive, first send a message through the same mail command or inspect the MTA’s queue and logs; a running smartmontools service cannot correct SMTP credentials, DNS, TLS, or provider-side relay restrictions.

After the test arrives, remove -M test from /etc/smartd.conf and restart the service again so ordinary restarts do not generate another test message. Keep -m in place. By default, smartd limits repeat alerts; depending on saved monitoring state, it sends an initial warning and may send daily reminders for an ongoing problem. That reduces inbox noise, while an operator who wants a different reminder cadence should review the installed smartd.conf(5) manual before changing -M.

Ubuntu terminal showing the smartmontools service active and an illustrative mail test confirmation
Example verification view: confirm service status and independently confirm that the test message reached its inbox.

What these alerts can and cannot tell you

smartd checks devices periodically, with a default polling interval of 30 minutes, so an alert is not instantaneous. It can report supported health failures, new log errors, and other configured conditions. SMART attributes are vendor-dependent, and a healthy summary does not rule out a sudden electronic, mechanical, controller, or connection failure. Keep backups and investigate a warning with sudo smartctl -a /dev/sda and the drive manufacturer’s guidance rather than treating one status line as a complete diagnosis.

For exact directive behavior and supported device types, consult the Ubuntu smartd.conf manual and Ubuntu smartd manual. Ubuntu documents SMTP smarthost configuration in its Postfix setup guide; Ubuntu’s package index lists the msmtp-mta package for systems choosing a lightweight SMTP client.

Leave a Comment

Get Ubuntu SMART Disk Warnings by Email with smartd

Get Ubuntu SMART Disk Warnings by Email with smartd

Compare mail delivery options, configure smartd on Ubuntu, and verify that disk-health warnings reach your inbox.

Debian 12 DNS Lookup Failures: Repair systemd-resolved

Debian 12 DNS Lookup Failures: Repair systemd-resolved

Restore DNS lookups on Debian 12 by checking systemd-resolved, repairing resolv.conf when needed, and verifying upstream DNS and application resolution.

Ubuntu 24.04 Won’t Show HDMI Audio? Restore the Output

Ubuntu 24.04 Won’t Show HDMI Audio? Restore the Output

Get Ubuntu to detect your monitor or TV as an audio output, select it in Sound settings, and check the connection or PipeWire device list if HDMI is missing.

Fix APT Signature Errors by Repairing the Repository Key

Fix APT Signature Errors by Repairing the Repository Key

Resolve Ubuntu APT signature warnings safely by identifying the failing source, refreshing its verified key, and checking the result without disabling security.

How to Convert Three-Phase Voltage, Current, kW, kVA, and Power Factor

How to Convert Three-Phase Voltage, Current, kW, kVA, and Power Factor

Learn the balanced three-phase formulas and convert line voltage, current, kW, kVA, and power factor step by step, with a worked example and limits to check.

Cap a Command’s CPU and Memory Use with Ubuntu cgroups

Cap a Command’s CPU and Memory Use with Ubuntu cgroups

Run a workload inside a systemd scope with CPUQuota and MemoryMax, then verify the limits through cgroup v2.

Encrypt Pi-hole Upstream DNS on Ubuntu Server 24.04

Encrypt Pi-hole Upstream DNS on Ubuntu Server 24.04

Set up dnscrypt-proxy as Pi-hole’s local DoH bridge on Ubuntu 24.04, with a localhost-only listener, resolver selection, and checks before switching DNS.

Get Ubuntu 24.04 Touchpad Gestures Working on Wayland

Get Ubuntu 24.04 Touchpad Gestures Working on Wayland

Check Ubuntu’s touchpad settings, confirm Wayland, and test GNOME’s built-in swipes before troubleshooting apps or hardware.

Build a Debian 12 RAID 1 Mirror with mdadm

Build a Debian 12 RAID 1 Mirror with mdadm

Create and verify a two-disk Debian 12 RAID 1 data array, format it safely, and configure it to assemble and mount after reboot.

Encrypt Debian 12 Swap with a Fresh Key at Every Boot

Encrypt Debian 12 Swap with a Fresh Key at Every Boot

Set up random-key encryption for an existing Debian 12 swap partition, verify the active dm-crypt mapping, and understand the hibernation trade-off.