Using the smartmontools tool, it is possible to periodically check the disk status by querying the SATA or SCSI controller and asking them to perform a low-level audit.

Build information

Ensure the following options:

sysutils/smartmontools
1
# No selectable options

Disk status

The installation and configuration is as follows to check the /dev/ada0 hard drive with a short test around 2AM every day and a long test every Saturday around 4AM.

smartd.conf
1
/dev/ada0 -a -H -s (S/../.././02|L/../../6/04) -m root@example.com
rc.conf
1
smartd_enable="YES"                     # Check the disk health

The command smartctl can be used to get a result “immediately”:

Option Description
-t short performs a short test (about a few minutes)
-t long performs a long test (about an hour)
-a displays all information, including the outcome or the status of current tests
-X abort the test

According to the firmware on the hard drives, making a request to monitor the progress of the test can stop it. It is however possible to check beforehand the behaviour of the disk when using the command:

1
smartctl -c /dev/ada0

and check the following capabilities:

Message Test aborted
Abort Offline collection upon new command Yes
Suspend Offline collection upon new command No