CentOS 8 Software RAID Monitoring

Sunday, July 5, 2020

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 protected], [email protected]

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 /etc/systemd/system/mdadm-monitor.service:

[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!

linuxraidmdadmlinuxcentos8

Vagrant, Libvirt, and nftables

Use JQuery to Write Data to a Variable