In addition to the system's own periodic scripts, which perform many regular tasks to maintain, heal or inform the system, the status of the hard disks can also be monitored.
Three aspects are of particular interest here:
NEW: For the very impatient I have a console only section. There are only commands, no explanations.
Last update:
smartd
cannot send alarm e-mailsSmartmontools are a good and, above all, very common basis for maintaining the status of hard disks. The smartmontools
package is quickly installed after adapting the package source with pkg install -y smartmontools
. The service is activated with service smartd enable
.
With sysrc -f /etc/periodic.conf daily_status_smart_devices=‘YES’
the status of the hard disks is included in the daily system reports every day. The configuration is then customized with ee /usr/local/etc/smartd.conf
(many other examples are listed in /usr/local/etc/smartd.conf.sample
).
The following is to be achieved here: "Monitor all hard disks recognized on the system for their vital values, keep an eye on the temperature and send warnings by e-mail if something is stuck. A short self-test is carried out every Sunday and an additional long self-test is carried out at the beginning of each month."
At first glance, the syntax is somewhat confusing, but it is explained quite quickly:
-a
are the default values: -H -f -t -l error -l selftest -l selfteststs -C 197 -U 198
-n standby
should not run tests when the hard drive is asleep-W 4,30,40
monitors the temperature and reports fluctuations of 4°C from 30°C or when the critical 40°C is exceeded-m root
E-Mail Receiver , e.g. root
-s
plans the self-tests:
S/../../7/01
= S (short) Test on the 7th day of the week|
= undL/../01/./00
= L (long) Test on the 1st day of the monthIn total, we then have one line for all hard drives:
DEVICESCAN -a -n standby -W 4,30,40 -m root -s (S/../../7/01|L/../01/./00)
An example e-mail could look like this:
pkg install -y smartmontools
sysrc -f /etc/periodic.conf daily_status_smart_devices="YES"
service smartd enable
ee /usr/local/etc/smartd.conf
DEVICESCAN -a -n standby -W 4,30,40 -m root -s (S/../../7/01|L/../01/./00)
service smartd start
Voilá