mdadm is the utility to check and report failures on RAID disks. The usual way this Linux application send its message is a plain old e-mail. In this howto you’ll find the instruction to use an external mail server with mdadm.
First, replace sendmail with an external email account. After you’ve configured and tested msmtp you’re ready to configure mdadm.
Configure mdadm with the new SMTP
Change /etc/mdadm/mdadm.conf to
# instruct the monitoring daemon where to send mail alerts # MAILADDR root MAILADDR firstname.lastname@example.org MAILFROM email@example.com
- firstname.lastname@example.org is your FROM e-mail, the email or alias you’re sending emails from.
- email@example.com is your recipient TO e-mail. It must be a frequently-used e-mail since alerts of failures are sent there.
Actually, using /etc/aliases and assigning root to the right recipient should allow you to avoid this step but you’ve to test yourself.
Send test message with mdadm
Type this command to emulate a disk failure message from mdadm:
sudo mdadm --monitor --scan --test -1
If you receive the message in the firstname.lastname@example.org this job is finally done!
This is an automatically generated mail message from mdadm running on YOURSERVERHOSTNAME A TestMessage event had been detected on md device /dev/md/1. Faithfully yours, etc. P.S. The /proc/mdstat file currently contains the following: Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10] md0 : active raid... md1 : active raid... unused devices: ...