Testing a failure on my RAID1 array

When I configured my Ubuntu system to boot from a software RAID1 array, Postfix came with it. I needed to setup Postfix to pass messages to my Internet e-mail address. Luckily, David GrantĀ seems to have already figured that part out.

sudo dpkg-reconfigure postfix

After selecting satellite, the only info I needed to supply was my ISP’s SMTP server. I accepted the defaults for everything else. My ISP wouldn’t accept e-mail from my machine either, so I had to perform the steps in the update section of his post. For completeness this is:

Adding this to /etc/postfix/main.cf:

smtp_generic_maps = hash:/etc/postfix/generic

and creating a /etc/postfix/generic with this in it:

@ubuntu_server ubuntu_server@jfamiglietti.com

Interestingly enough, the domain name actually needed to exist for my ISP’s mail server to accept it, so I used my own. (My server’s name is not actually ubuntu_server, it’s just an example)

… and yes, don’t forget:

sudo postmap /etc/postfix/generic

Anyway, back to my simulated failure. All I had to do was set my e-mail address in the MAILADDR field of my /etc/mdadm/mdadm.conf.

This was enough to kill my setup:

sudo mdadm --manage /dev/md0 --fail /dev/sdb1

Almost immediately, I got an e-mail from “mdadm monitoring” informing me of the failure. I removed the “bad” drive from the array:

sudo mdadm --manage /dev/md0 --remove /dev/sdb1

Since there is really nothing wrong with it and it’s already partitioned correctly, I just added it back and let it sync up.

sudo mdadm --add /dev/md0 /dev/sdb1

I did need to reinstall grub because when I disconnected /dev/sda, it booted to the grub rescue prompt

sudo grub-install /dev/sdb

When I attempted to boot it again with /dev/sda missing, I got an e-mail. Like everything else I’ve attempted with this Linux server so far, it worked perfectly!

Ok, I’ll let you in on a little secret. I didn’t do that on my actual server, I tested it in my VirtualBox machine. On my actual server, I performed the same setup for Postfix, then just issued this command to ensure the e-mail was working:

sudo mdadm --monitor --scan --test

After sending the test message, mdadm continued monitoring the array, so I had to stop it with a control-C. Successfully getting the test message was good enough for me, I really just wanted to know mdadm could get messages out when necessary.

This entry was posted in Linux and tagged , . Bookmark the permalink. Follow any comments here with the RSS feed for this post. Both comments and trackbacks are currently closed.