Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 2 down vote accepted

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


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

share|improve this answer
Yeah, I never read my local mailbox. I ended up creating a simple script to send email to my normal mailbox, and setup a cron job to run mdadm regularly, using the --program param to execute my email script to notify me. – Cerin Aug 14 '10 at 13:20
I have a degraded array but "no mail for root" – Bryce Oct 30 '12 at 23:16
@Bryce That's probably because you aren't getting mail for root at all. See the question I linked to on the Ubuntu site (which sadly doesn't have up-to-date answers). – Gilles Oct 30 '12 at 23:19
You have to install and configure an MTA to send mail to root off the system. The package postfix is a good choice for this. – milli Feb 15 '14 at 8:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .