{"id":295,"date":"2015-04-21T14:53:58","date_gmt":"2015-04-21T21:53:58","guid":{"rendered":"http:\/\/blog.ioflood.com\/?p=295"},"modified":"2023-08-11T17:23:46","modified_gmt":"2023-08-12T00:23:46","slug":"setting-up-software-raid-mdadm-status-alert-emails-for-failed-drives-in-centos-ubuntu-and-debian","status":"publish","type":"post","link":"https:\/\/ioflood.com\/blog\/setting-up-software-raid-mdadm-status-alert-emails-for-failed-drives-in-centos-ubuntu-and-debian\/","title":{"rendered":"Setting up Software RAID \/ MDADM status alert Emails for failed drives in Centos, Ubuntu, and Debian"},"content":{"rendered":"<div style=\"width: 310px\" class=\"wp-caption alignright\"><img decoding=\"async\" class=\"alignright\" title=\"Subscribe to The Propagandist Email Alerts by Jonathon Narvey\" src=\"https:\/\/ioflood.com\/blog\/wp-content\/uploads\/2015\/04\/4819220202_c81b643734_email-alerts.jpg\" alt=\"email alerts photo\" width=\"300\" height=\"296\" \/><p class=\"wp-caption-text\"><small>Photo by <a href=\"http:\/\/www.flickr.com\/photos\/10014973@N00\/4819220202\" target=\"_blank\" rel=\"noopener\">Jonathon Narvey<\/a> <a title=\"Attribution License\" href=\"http:\/\/creativecommons.org\/licenses\/by\/2.0\/\" target=\"_blank\" rel=\"nofollow noopener\"><img decoding=\"async\" src=\"https:\/\/ioflood.com\/blog\/wp-content\/plugins\/wp-inject\/images\/cc.png\" alt=\"Creative Commons Logo\" title=\"\"><\/a><\/small><\/p><\/div>\r\n\r\nIssues regarding software and hardware raid are no stranger to the IOFlood blog, with articles discussing the relative merits of each, articles discussing why raid is important (and so are backups), and so on. But RAID only provides protection against failed drives if you realize a drive has failed and replace it. Often times, a failed drive will go unnoticed until after the backup drive\u00a0has also failed. Needless to say, this can lead to data loss, and so getting early notifications of failed drives is very important in RAID.\r\n\r\nIn this article, we will give you a brief overview of how to configure email based alerts for software raid \/ MDADM under Centos, Ubuntu, and Debian. Setting this up is an important part of any data security strategy. The steps are relatively easy, but it&#8217;s always good to have a working reference to look at if you don&#8217;t do this every day. So without further ado&#8230;..\r\n\r\n<hr \/>\r\n\r\n<h2><\/h2>\r\n<h2>Easy instructions for setting up mdadm \/ software raid email alerts for failed drives in Centos, Ubuntu, and Debian:<\/h2>\r\nFirst off, start by editing the following file.\r\n\r\nOn Centos:\r\n<pre style=\"padding-left: 30px;\">nano \/etc\/mdadm.conf<\/pre>\r\nOn Debian \/ Ubuntu:\r\n<pre style=\"padding-left: 30px;\">nano \/etc\/mdadm\/mdadm.conf<\/pre>\r\nMake sure the configuration file it has the following line in it. If it doesn&#8217;t, copy and paste it in there:\r\n<pre style=\"padding-left: 30px;\">DEVICE partitions\r\n<\/pre>\r\nAlso add to this file the email address you&#8217;d like to have receive notifications:\r\n<pre style=\"padding-left: 30px;\">MAILADDR bill@ted.com<\/pre>\r\nAnd then save the file and exit.\r\n\r\nNext we run the process and make sure it runs without error.\r\n<pre style=\"padding-left: 30px;\">\/sbin\/mdadm --monitor --scan --daemonize\r\n<\/pre>\r\nIf this works correctly, we will want to make sure that this command runs at boot time. Edit the following file:\r\n<pre style=\"padding-left: 30px;\">nano \/etc\/rc.local<\/pre>\r\nAnd copy and paste the line near the end of the file:\r\n<pre style=\"padding-left: 30px;\">\/sbin\/mdadm --monitor --scan --daemonize<\/pre>\r\nWARNING: The last line in \/etc\/rc.local for Debian (and possibly Ubuntu installs) is &#8220;exit 0&#8221; so you need to make sure that the command above goes BEFORE that line otherwise it will never run.\r\n\r\nFinally, if you&#8217;d like to test that emails are being sent properly, you can run the following command:\r\n<pre style=\"padding-left: 30px;\">\/sbin\/mdadm --monitor --scan --test<\/pre>\r\nThis will send you an email regarding the current status of your raid arrays. Be sure to whitelist these emails so that when a real raid alert comes in, your email provider doesn&#8217;t send it to your spam box!\r\n\r\n<hr \/>\r\n\r\nThat&#8217;s it! You&#8217;ve now set up your server to send you email alerts whenever a failure event occurs in MDADM \/ software raid. The above instructions should work equally well for Centos, Ubuntu, and Debian. This is an easy, but often overlooked, important first step in ensuring your data security.\r\n\r\nIn a future article, we&#8217;ll be discussing how to set up raid alerts for LSI-9271 hardware raid (hint: it&#8217;s not as easy), so stay tuned if you use LSI hardware raid cards.\r\n\r\n<strong><\/strong>\r\n<h2 class=\"wp-block-heading\">Do you love servers?<\/h2>\r\n<strong> <\/strong>\r\n\r\nIf you love servers like we do, we&#8217;d love to work together! IOFLOOD.com offers dedicated servers to people like you, and as part of that service, we configure alerts to notify us if there are any problems with your raid array, so that we can help you avoid an array failure. To get started today, <a href=\"https:\/\/ioflood.com\/phoenix-dedicated-servers.php\">click here to view our dedicated servers<\/a>, or email us at sales[at]ioflood.com to ask for a custom quote.\r\n\r\n<strong>\r\n<\/strong>","protected":false},"excerpt":{"rendered":"<p>Issues regarding software and hardware raid are no stranger to the IOFlood blog, with articles discussing the relative merits of each, articles discussing why raid is important (and so are backups), and so on. But RAID only provides protection against failed drives if you realize a drive has failed and replace it. Often times, a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":468,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,5,3,113,14,115,112,9,6],"tags":[],"class_list":["post-295","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","category-debian","category-linux","category-mdadm","category-raid","category-redhat-enterprise-linux-rhel","category-software-raid","category-sysadmin","category-ubuntu","cat-4-id","cat-5-id","cat-3-id","cat-113-id","cat-14-id","cat-115-id","cat-112-id","cat-9-id","cat-6-id","has_thumb"],"_links":{"self":[{"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/posts\/295","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/comments?post=295"}],"version-history":[{"count":9,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/posts\/295\/revisions"}],"predecessor-version":[{"id":3108,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/posts\/295\/revisions\/3108"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/media\/468"}],"wp:attachment":[{"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/media?parent=295"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/categories?post=295"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/tags?post=295"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}