How to setup a RAID5 software (mdadm) array w/ email notifications via Gmail – the easy way

Long title I know…
So I finally setup a NAS using Ubuntu Intrepid (8.10) Desktop, at first I was looking into using a pre-built solution such as FreeNAS or Openfiler but that limited the boxes ability to do other things (like serving up webpages using LAMP, etc.) besides I like having a Desktop GUI that I can play with if things go wrong.  So after figuring out what version of Ubuntu to use (Hardy for it’s LTS or Intrepid for latest and greatest) I decided on Intrepid.

My setup:
MoBo: Intel D865GBF Desktop Board
CPU: P4 3.0Ghz
RAM: 4x1GB G.Skill Sticks
VIDEO: FX5200 AGP card
IDE1: Seagate 250GB (ST380013A)
IDE2: Maxtor 250GB (Diamond Max Plus9)
SATA1: Western Digital 320GB (WD3200JD-22KLB0)
SATA2: Seagate 200GB (ST300822AS) – ***UBUNTU INSTALLED ON THIS ONE***

So I will be using IDE1,IDE2, & SATA1 for my RAID5 Array.

After a quick shout to the Ubuntu Community I found this wonderfully simple guide on setting up a RAID5 array using mdadm: http://bfish.xaedalus.net/?p=188

I did however run into one problem with the guide:

sudo mdadm –detail –scan >> /etc/mdadm/mdadm.conf

Which adds the following to my mdadm.conf file:

ARRAY /dev/md0 level=raid5 num-devices=3 metadata=00.90 UUID=13f95aef:9c364189:75b10d3a:87a53e2f

but after I’ve added that to the mdadm.conf and when I run the following:

sudo mdadm –examine –scan
mdadm: metadata format 00.90 unknown, ignored.
ARRAY /dev/md0 level=raid5 num-devices=3 UUID=13f95aef:9c364189:75b10d3a:87a53e2f

Notice: mdadm: metadata format 00.90 unknown, ignored.
So I had to remove “metadata=00.90” from my mdadm.conf file and I no longer get that message.
Anyone know why the metadata entry isn’t working?

And now on to setting up email notifications via Gmail – The easy way…

After spending literally hours trying to get postfix working and running into problems getting the SSL CA certificates working I gave up on postfix all together and started looking for an alternative, and after a few google searches I found one: http://www.manu-j.com/blog/wordpress-exim4-ubuntu-gmail-smtp/75/

This guide walks you thru setting up exim4 to work with Gmail, and it works perfectly, the only problem I ran into with this guide was that you need to comment out the whole “login:” section of /etc/exim4/exim4.conf.template like so:

#Commented out so that Gmail’s Public_name can equal “LOGIN”
#login:
# driver = plaintext
# public_name = LOGIN
#.ifndef AUTH_CLIENT_ALLOW_NOTLS_PASSWORDS
# Return empty string if not non-TLS AND looking up $host in passwd-file
# yields a non-empty string; fail otherwise.
# client_send = “<; ${if and{\
# {!eq{$tls_cipher}{}}\
# {!eq{PASSWDLINE}{}}\
# }\
# {}fail}\
# ; ${extract{1}{::}{PASSWDLINE}}\
# ; ${sg{PASSWDLINE}{\\N([^:]+:)(.*)\\N}{\\$2}}”
#.else
# Return empty string if looking up $host in passwd-file yields a
# non-empty string; fail otherwise.
# client_send = “<; ${if !eq{PASSWDLINE}{}\
# {}fail}\
# ; ${extract{1}{::}{PASSWDLINE}}\
# ; ${sg{PASSWDLINE}{\\N([^:]+:)(.*)\\N}{\\$2}}”
#.endif
#####################################################
### end auth/30_exim4-config_examples
#####################################################

Now simply edit your /etc/mdadm/mdadm.conf file to read:

# instruct the monitoring daemon where to send mail alerts
MAILADDR {YourEmailAddress_Where-you-want-mdadm-notifications-sent@email.com}

Now you should be all set give it a test by running:

sudo mdadm –monitor –scan –test

And you should have an email within minutes 😀

16 Responses to How to setup a RAID5 software (mdadm) array w/ email notifications via Gmail – the easy way

  1. Jari Huhtamäki says:

    Here is another way of getting eMail from your system .. seem to be even more simple method. And works great with mdadm.

    http://tombuntu.com/index.php/2008/10/21/sending-email-from-your-system-with-ssmtp/

    • basskozz says:

      Thanks Jari,
      I wish I would’ve found that post earlier, as it does seem a bit easier to implement…
      Maybe I use this solution on the next rig I setup, but for now exim4 works for me 😉
      Thanks again,
      -BassKozz

  2. Patrick says:

    Hey basskozz!
    My server is sending email through Gmail like the guide you you showed in here. I also notice that you were having problems with the server sending local mail like (root@yourserver or username@yourserver) to Gmail. Were you able to fix this?

  3. Liza says:

    I can tell that this is not the first time you mention this topic. Why have you decided to touch it again?

  4. Skat says:

    Thanks for this post Basskozz.

    Just a thought, instead to remove “metadata=00.90” from your mdadm.conf file, replace it by “metadata=0.90”. mdadm will work fine. This error seems related to a bad metadata formatting by mdadm when it is called to write raid array information on mdadm.conf. It should be fixed on next 2.6.8 release.

    Have a look on this post for more informations: http://ubuntuforums.org/showthread.php?t=1007464

  5. Roger Krupski says:

    A better email solution is to create a file named “.forward” (that’s “dot-forward”) in root’s root directory (that is, the file should be /root/.forward).

    The content of this file is a single line… your complete “real” email address in the outside world.

    Now, when ANYTHING in the server wants to send administrative email (which it sends to root), it will be re-directed to your real email address.

    -eof-

  6. Ben Leivian says:

    Thanks for the guide!

  7. GUiLTY says:

    Take a look at this other solution.

    Instead of use exim4 it uses a much more lightweight solution with ssmtp.

    Great tutorial!

  8. what is an affiliate says:

    Fantastic goods from you, man. I have take into account your stuff previous to and you are simply too magnificent. I actually like what you’ve got right here, really like what you’re saying and the best way in which you are saying it. You make it entertaining and you continue to care for to stay it sensible. I can not wait to learn much more from you. That is actually a tremendous website.

  9. naw says:

    apt-get install ssmtp is leagues better than any of the email crap you were trying to setup, fyi

  10. Charles V. says:

    Hi,

    I would like to propose the link exchange deal with your website basskozz.wordpress.com, for mutual benefit in getting more traffic and improve search engine’s ranking, absolutely no money involve.

    We will link to you from our Society, Legal, and News Authority Site – https://www.integratedlawfirm.com/, from its homepage’s sidebar. In return you will agree to do the same to link back to one of our of our Personal Injury website based in Dallas, Texas, from your basskozz.wordpress.com’s homepage too (sidebar, footer, or anywhere on your homepage), with our brand name Personal Injuries Legal.

    If you are interested, kindly reply to this email.

    Thank you,
    Charles

  11. I visit each day some web sites and blogs to

Leave a reply to Patrick Cancel reply