S.M.A.R.T. monitoring

From freebsd.xn--wesstrm-f1a.se

Jump to: navigation, search



Self-Monitoring, Analysis and Reporting Technology is a pre-failure monitoring system for hard disks. It's in no way guaranteed to catch any hardware failures of your hard disks before they happen but it never hurts to enable it. Advance warning is always better than having to deal with a crashed hard disk.


S.M.A.R.T. depends on your BIOS supporting this feature so you have to check first that it's enabled in your computer's BIOS before continuing. You have to consult your computer's manual for this. If it's supported and enabled you can install the necessary software.

# cd /usr/ports/sysutils/smartmontools
# make
# make install clean
# rehash

Add the service to /etc/rc.conf.

# cat 'smartd_enable="YES"' >> /etc/rc.conf

Now, load the configuration file in your editor.

# ee /usr/local/etc/smartd.conf

The default setting is to scan for available drives every time the service starts but it's preferred to define each drive you want to monitor on its own row since this makes it possible to define the monitoring behaviour more precisely. So find the single uncommented line that reads


and comment it with a # first on that line. Then add rows below it for each of your hard disks.

/dev/ad10 -a -m smart@pp.dyndns.biz -M daily -s S/../../7/22
/dev/ad12 -a -m smart@pp.dyndns.biz -M daily -s S/../../7/22

This example monitors all S.M.A.R.T. attributes on /dev/ad10 and /dev/ad12, makes a short S.M.A.R.T. test every Sunday evening after 10 p.m. and mails any errors to smart@pp.dyndns.biz. The config file is full of examples and together with the manual page you can find a scheme that suits your own needs. Remember to enter the correct device nodes for your own disks. If you don't remember their names you can list them with gmirror status if you use gmirror. Otherwise they can be found in /dev and in /etc/fstab.


Errors, warnings and other info are logged to /var/log/messages by default but smartmontools can be a little spammy so it's a good idea to redirect its messages to a separate log-file. Add these lines to the end of /etc/syslog.conf:

*.*						/var/log/smartd

Configure logrotating.

# echo "/var/log/smartd				644  3     100  *     JC" >> /etc/newsyslog.conf

Create the log-file.

# touch /var/log/smartd

Make syslogd reread its configuration files.

# killall -HUP syslogd

Finally start smartmontools.

# /usr/local/etc/rc.d/smartd start
Starting smartd.


  • /usr/local/etc/smartd.conf is the configuration file for smartmontools.


Personal tools