Automatic Notification of Degraded RAID Array in Ubuntu

Posted on

Problem :

I’m running Ubuntu 10.04 on top of a RAID-1 array. Out of curiosity, I decided to bring up the “Disk Utility” program to inspect the status of my array. To my surprise, the array was listed as “Degraded”, with one of the drives being faulty. Had my other drive failed, I would have lost all my data. Is there a way to setup Ubuntu to automatically notify me via email or some other means when RAID is degraded?

It seems strange to have such great software RAID support in Ubuntu, and then throw it all away by not communicating RAID failures to the user. I was thinking of writing a cron job to monitor “cat /proc/mdstat” and send me an email if the “failed drive” pattern was seen, but I don’t want to reinvent the wheel.

Solution :

By default, /etc/mdadm/mdadm.conf contains the line

MAILADDR root

I can confirm that on Ubuntu 8.04, this does result in mail being sent to root when the array is degraded (and I don’t see why this would work differently in other releases).

The problem is that the mail is sent to root, and Ubuntu doesn’t seem to have set up anything so that administrator users would read root’s mail. It used to; I see that on a machine whose initial installation was Ubuntu 4.10, /etc/aliases contains

# Added by Ubuntu installer
root:   myusername

which does result in root’s mail being redirected to my local mailbox, which I do read.

Maybe Ubuntu stopped setting up /etc/aliases because most people aren’t even aware that there is such a thing as local mailboxes. But it would be a good idea for Ubuntu to arrange that administrators receive root’s mail somehow. Maybe you could make a feature request (or add your voice to an existing one, I haven’t looked). (Strictly speaking, it’s a regression from warty!)

Leave a Reply

Your email address will not be published.