The Self-Monitoring, Analysis, and Reporting Technology System (SMART) built into most modern hard disks. The purpose of SMART is to monitor the reliability of the hard drive and predict drive failures, and to carry out different types of drive self-tests under FreeBSD operating systems. This page shows how to install smartmontools on FreeBSD and use smartcl to check hard drive health on FreeBSD.

 

Install smartmontools on FreeBSD

 

Use FreeBSD ports system as follows to install the same:

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

 

OR one can binary package system. Run the following pkg command:

# pkg install smartmontools

 

The smartmontools package contains two utility programs for FreeBSD:

smartctl command – A command line tool to control and monitor hard disks health.

smartd – It is a FreeBSD daemon that monitors hard disks health and alert users about problems using log files, email and more.

 

How to check hard drive health on FreeBSD?

 

The syntax is as follows to check the status of drives:

smartctl -a /dev/disk

 

One can get a list all connected hard drives in FreeBSD by running the following commands:

# camcontrol devlist

 

OR use the grep command/egrep command as follows:

# egrep 'ad[0-9]|cd[0-9]' /var/run/dmesg.boot
egrep 'da[0-9]|cd[0-9]' /var/run/dmesg.boot

 

FreeeBSD hard drive health checkups

 

Now you know hard disk device named on FreeBSD. Therefore, it is time to check hard disk information, run:

# smartctl -i /dev/ada0

 

Check disk health, run:

# smartctl -a /dev/ada0

 

How to configure smartd to get email alert

 

Edit the file as following using the vim command:

# cd /usr/local/etc
# cp smartd.conf.sample smartd.conf
# vim smartd.conf

 

First, comment out or delete all DEVICESCAN lines:

# DEVICESCAN

 

Next explicitly list the devices that you wish to monitor. For example:

/dev/ada0 -a -m disk.admin@your-tld

 

Add all of your disks too:

/dev/ada1 -a -m disk.admin@your-tld,root@localhost

 

See smartd.conf man page for more info. Make sure smartd start at boot time, run:

echo 'smartd_enable="YES"' >> /etc/rc.conf

 

Start/stop/restart the service

# service smartd start
# service smartd restart
# service smartd status
# service smartd stop

 

Was this answer helpful? 1 Users Found This Useful (2 Votes)