Checking disk health by hand only works until the day you forget, which is exactly the gap smartd is built to close. By the end, it will monitor the drives you name, send warnings through the machine's mail system, and run scheduled self-tests without needlessly waking a disk from standby. This guide targets the Linux build of smartmontools 7.4, released on 1 August 2023. Allow 20 to 30 minutes if you know which disks you want monitored, or longer if you first need to map disks behind a controller.
The daemon talks to storage hardware and normally needs root privileges. Reading its version and inspecting configuration syntax does not change a disk. Starting or reloading the service changes monitoring behaviour, and a scheduled self-test consumes disk time, so check the device names before enabling either.
Run these ordinary commands first. The block device name is not a safe substitute for a serial number: names such as /dev/sda can change after hardware or boot-order changes.
smartd --version
lsblk -dn -o NAME,TYPE,SIZE,MODEL,SERIAL
On the reference installation, the version command reports smartmontools 7.4, revision 5530. Use smartctl to confirm each candidate before putting it in the daemon configuration:
sudo smartctl -i /dev/sdX
Replace /dev/sdX with a real disk, not a partition such as /dev/sdX1. If the disk is behind USB, SAT, or a RAID controller, the device type may need a -d directive. Follow the device-specific output and the smartctl(8) documentation before guessing.
Checkpoint: You have a list of real disk paths, their models or serials, and any controller-specific device types. Do not continue with a copied /dev/sda example unless that is genuinely the disk you intend to watch.
With no configuration file, smartd scans possible ATA, SCSI and, in this Linux build, NVMe devices. That is convenient but can produce errors for devices that dislike SMART commands, and it gives you less control. An explicit file is easier to review.
-a, which monitors all supported SMART properties.-H -l error -l selftest -f monitors health status, ATA errors, self-test errors, and failed Usage Attributes, and stays quieter.-t when you also want changes in all attributes recorded.Decide whether polling may wake an idle disk. The default is -n never, which checks regardless of power mode and can spin up a disk. -n standby skips checks while the disk is in sleep or standby, although the initial registration can still wake a disk that is already in standby. On a laptop or a storage host with deliberately sleeping disks, this distinction matters.
This is an elevated edit because the normal file is /etc/smartd.conf. The example monitors one disk, avoids standby wake-ups during periodic polling, schedules a short test every morning, and sends warnings to an obvious placeholder address.
sudoedit /etc/smartd.conf
# Replace /dev/sdX and [email protected] before enabling this.
/dev/sdX -H -l error -l selftest -f -n standby \
-s S/../.././02 -m [email protected]
The regular expression after -s means a short self-test in the 02:00 to 03:00 window every day. A long test on Sundays between 04:00 and 05:00 would be -s L/../../7/04. These are windows, not exact start times: the test starts after a regular poll matches the expression.
Configuration lines use one device per line. A hash starts a comment, and a trailing backslash continues a line. The file should be writable only by root:
sudo chown root:root /etc/smartd.conf
sudo chmod 0644 /etc/smartd.conf
sudo smartd -c /etc/smartd.conf -q showtests
The final command performs a dry scheduling check and prints upcoming tests. It does not start the daemon. If it reports an unknown directive, an invalid device, or an unavailable test, fix that before reloading anything.
The -m directive is only useful if a mailer is configured. By default smartd invokes the system mail command. Multiple recipients are comma-separated with no spaces. -M test asks for one test message at daemon startup, so use it only after checking the address and the host's mail setup.
# Temporary notification test: add -M test to the device line,
# start or reload smartd, then remove -M test afterwards.
/dev/sdX -H -l error -l selftest -f -n standby \
-s S/../.././02 -m [email protected] -M test
Warnings are rate-limited by default. -M once sends one warning for each problem type; -M daily permits daily reminders when state persistence is enabled. Do not use -M always casually, because smartd 7.4 can send a reminder on each check.
Before touching the running daemon, make a temporary copy of the policy and ask smartd to parse it. This command is read-only with respect to the installed configuration and service:
install -m 0644 /etc/smartd.conf /tmp/smartd.conf.check
sudo smartd -c /tmp/smartd.conf.check -q showtests
Successful output includes scheduled tests and ends with a successful exit status. The -q onecheck mode goes further: it registers devices, checks SMART once, then exits. It can issue hardware queries, so run it only with the intended device list and expect that it may take a little time:
sudo smartd -c /tmp/smartd.conf.check -q onecheck
printf 'smartd check exit status: %s\n' "$?"
A non-zero result is not a harmless warning. Investigate the preceding device error, controller type, permissions, or mail configuration. The daemon's default quit policy is nodev, so it exits if it cannot monitor any device.
On systems using the packaged unit, the service runs /usr/sbin/smartd -n and uses HUP for reloads. First inspect the unit and current state:
systemctl cat smartd.service
systemctl status smartd.service --no-pager
If the policy passed both checks, start the service with elevated privileges:
sudo systemctl enable --now smartd.service
sudo systemctl reload smartd.service
sudo systemctl status smartd.service --no-pager
Recovery: Do not use enable until you want monitoring to return after a reboot. If a reload finds a syntax error, smartd logs the error and keeps its previous configuration instead of applying the faulty file. Repair the file, rerun -q showtests, then reload again. To undo the service change, use sudo systemctl disable --now smartd.service; this stops future checks but does not undo any self-test already running.
smartd normally writes through syslog, often to the journal on a systemd host. Look for startup, registration, skipped standby polls, and self-test messages:
sudo journalctl -u smartd.service -b --no-pager
sudo journalctl -u smartd.service -f
To force an immediate status poll, send SIGUSR1 to the daemon. This is an elevated, hardware-accessing operation, and it may wake a disk unless that device uses -n standby:
sudo systemctl kill --signal=USR1 smartd.service
For an actual disk diagnosis, use smartctl and preserve its output. smartd is an alerting daemon, not a substitute for a backup or for examining the drive's complete error and self-test logs. A warning about pending or uncorrectable sectors is a reason to protect the data first, not to start repeated tests blindly.
smartctl -i; device letters are not permanent identities.-n standby, but remember that startup registration may still wake a disk in a low-power mode.-s uses extended regular expressions, not shell globs. Check the result with -q showtests.-d value and a controller device path.-M test temporarily and inspect the journal in debug mode if necessary.DEVICESCAN causes smartd to ignore later lines. Put explicit exceptions before it, or remove it while using explicit entries.smartd -q showtests succeeds against the intended configuration.smartd -q onecheck succeeds, or its device-specific failure has been understood and resolved.