My current home server uses software Linux RAID to run my two large RAID arrays. By default, CentOS 8 does not monitor the status of these RAID devices for you. It is highly recommended that you set up the monitoring of your devices lest you forget and have all your data disappear.
The first thing that needs to be done is to populate the
/etc/mdadm.conf file. In order to populate it with your current RAID devices, run:
mdadm --verbose --detail --scan > /etc/mdadm.conf
Once it is populated you also need to add the option for your email address at the bottom of the file:
MAILADDR email@example.com, firstname.lastname@example.org
Once that file is created, run the following:
mdadm --monitor --test --scan
If it is set up correctly, then you should get an email at your listed address for each array listed in the
/etc/mdadm.conf file. If this doesn’t work, you might need to install
postfix and start it. I’m not going to go into securing your postfix server, but take a look at this article for more information.
Once you get the test emails, the final thing to do is to make a new systemd service file to start the monitoring process when the server boots up. Here is the one that I use. I placed it in
[Unit] Description=Starts the mdadm monitoring service After=network.target [Service] Type=simple ExecStart=mdadm --monitor --scan [Install] WantedBy=default.target
Reload the systemd units, and start/enable the new service. Now your software RAID is monitored and you can sleep at night!