{"id":243,"date":"2014-06-22T12:57:49","date_gmt":"2014-06-22T16:57:49","guid":{"rendered":"http:\/\/www.mufljuz.com\/?p=243"},"modified":"2014-09-23T10:44:53","modified_gmt":"2014-09-23T14:44:53","slug":"replacing-failed-disk-in-software-raid","status":"publish","type":"post","link":"https:\/\/www.mufljuz.com\/?p=243","title":{"rendered":"Replacing failed disk in software RAID"},"content":{"rendered":"<p>mark the drive as failed first<br \/>\n<code><br \/>\nmdadm \/dev\/mdX -f \/dev\/sdYX<br \/>\n<\/code><\/p>\n<p>Power down and physically replace faulty drive. Make sure the partitions are properly aligned, as in\u00a0<a title=\"http:\/\/www.ibm.com\/developerworks\/linux\/library\/l-4kb-sector-disks\/#tools\" href=\"http:\/\/www.ibm.com\/developerworks\/linux\/library\/l-4kb-sector-disks\/#tools\">http:\/\/www.ibm.com\/developerworks\/linux\/library\/l-4kb-sector-disks\/#tools<\/a><\/p>\n<p>Boot and partition new drive, and if you want to partition the new drive similar as others, you can do it with..<br \/>\n<code><br \/>\nsfdisk -d \/dev\/sdX | sfdisk \/dev\/sdY<br \/>\nmdadm --detail  \/dev\/mdX<br \/>\nmdadm \/dev\/mdX -a \/dev\/sdYX<br \/>\nwatch -n .1 cat \/proc\/mdstat<br \/>\n<\/code><\/p>\n<p>In case failed disk has not been removed from the raid, we might need to assemble raid manually.<br \/>\nFirst, examine current raid configuration, and if needed update system mdadm.conf.<br \/>\n<code><br \/>\nmdadm --examine --scan<br \/>\nnano -w \/etc\/mdadm.conf<br \/>\n<\/code><\/p>\n<p>Assemble raid:<br \/>\n<code><br \/>\nmdadm --assemble \/dev\/mdX<br \/>\nmdadm --assemble \/dev\/mdX --scan<br \/>\nmdadm --assemble \/dev\/mdX --scan --force<br \/>\n<\/code><\/p>\n<p>In case if the assembling fails, try to stop raid and assemble it after<br \/>\n<code><br \/>\nmdadm --stop \/dev\/mdX<br \/>\nmdadm --assemble \/dev\/mdX --scan --force<br \/>\n<\/code><\/p>\n<p>finally, add a new drive<br \/>\n<code><br \/>\nmdadm --manage \/dev\/mdX --add \/dev\/sdYX<br \/>\n<\/code><\/p>\n<p><strong>RAID repair<\/strong><br \/>\n<code>echo repair &gt;&gt; \/sys\/block\/md1\/md\/sync_action<br \/>\necho repair &gt;&gt; \/sys\/block\/md2\/md\/sync_action<\/code><code>echo repair &gt;&gt; \/sys\/block\/md3\/md\/sync_action<\/code><\/p>\n<p><strong>RAID maintenance and check<\/strong><br \/>\n<code>echo check &gt;&gt; \/sys\/block\/md1\/md\/sync_action<br \/>\necho check &gt;&gt; \/sys\/block\/md2\/md\/sync_action<br \/>\necho check &gt;&gt; \/sys\/block\/md3\/md\/sync_action<br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>mark the drive as failed first mdadm \/dev\/mdX -f \/dev\/sdYX Power down and physically replace faulty drive. Make sure the partitions are properly aligned, as in\u00a0http:\/\/www.ibm.com\/developerworks\/linux\/library\/l-4kb-sector-disks\/#tools Boot and partition new drive, and if you want to partition the new drive similar as others, you can do it with.. sfdisk -d \/dev\/sdX | sfdisk \/dev\/sdY mdadm [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.mufljuz.com\/index.php?rest_route=\/wp\/v2\/posts\/243"}],"collection":[{"href":"https:\/\/www.mufljuz.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mufljuz.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mufljuz.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mufljuz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=243"}],"version-history":[{"count":1,"href":"https:\/\/www.mufljuz.com\/index.php?rest_route=\/wp\/v2\/posts\/243\/revisions"}],"predecessor-version":[{"id":244,"href":"https:\/\/www.mufljuz.com\/index.php?rest_route=\/wp\/v2\/posts\/243\/revisions\/244"}],"wp:attachment":[{"href":"https:\/\/www.mufljuz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=243"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mufljuz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=243"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mufljuz.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=243"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}