{"id":1090,"date":"2020-07-02T15:28:38","date_gmt":"2020-07-02T15:28:38","guid":{"rendered":"https:\/\/www.nicktailor.com\/?p=1090"},"modified":"2022-10-21T11:26:02","modified_gmt":"2022-10-21T11:26:02","slug":"how-to-rebuild-a-drive-thats-fallen-out-of-software-raid","status":"publish","type":"post","link":"https:\/\/nicktailor.com\/tech-blog\/how-to-rebuild-a-drive-thats-fallen-out-of-software-raid\/","title":{"rendered":"How to rebuild a drive that\u2019s fallen out of a software raid"},"content":{"rendered":"<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\">Now I know nobody uses this kind of raid technology anymore, but it was one of the cool things I learned from my mentor at the time, when I first started my career centuries ago. I happen to find this in my archives and thought I would write up to share.<\/p>\n<p><strong><em>There is another way to do this as using mdadm &amp; sfdisk. When I find time I will share how to do that as well.<\/em> <\/strong><\/p>\n<div class=\"ol\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0; padding-bottom: 0; line-height: 1.3; margin-left: 36pt;\">\n<p><span style=\"display: inline-block; position: relative; text-indent: -18pt;\">1.<\/span>First thing you want to do is check to see drive has fallen out of the raid by running the following command below<\/p>\n<\/div>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3; margin-left: 54pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-style: italic;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">\u2022<\/span>&nbsp;<\/span><em>cat \/proc\/mdstat<\/em><\/div>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 54pt;\"><span style=\"color: #00b050;\">md<\/span><span style=\"color: #00b050;\">2 :<\/span><span style=\"color: #00b050;\"> active raid1 hda3[0] hdc3[1]<\/span><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 54pt;\"><span style=\"color: #00b050;\"> 524096 blocks [2\/2] [UU]<\/span><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 54pt;\"><span style=\"color: #00b050;\">md<\/span><span style=\"color: #00b050;\">1 :<\/span><span style=\"color: #00b050;\"> active raid1 hda2[0] hdc2[1]<\/span><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 54pt;\"><span style=\"color: #00b050;\"> 524096 blocks [2\/2] [UU]<\/span><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 54pt;\"><span style=\"color: #ff0000;\">md<\/span><span style=\"color: #ff0000;\">0 :<\/span><span style=\"color: #ff0000;\"> active raid1 hda1[0]<\/span><\/p>\n<p style=\"text-align: left; margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2; margin-left: 54pt;\"><span style=\"color: #ff0000;\"> 78994304 blocks [2\/1] [U_]<\/span><span style=\"color: #ff0000;\"> *You notice this one is showing a drive has fallen out*<\/span><\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><strong><em>Note:&nbsp;<\/em><\/strong><strong><em>If you see this, take notice to the one with <\/em><span style=\"color: #ff0000;\"><em>[U_] <\/em><\/span><em>this line means that the drive has fallen out of the raid. <\/em><\/strong><\/p>\n<p>1. To enter it back in run the lines below, based on the drive assignments in the above paritions that are good.<\/p>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0; padding-bottom: 0; line-height: 1.3; margin-left: 54pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-style: italic;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">\u2022<\/span>&nbsp;<\/span><em>raidhotadd \/dev\/md0 \/dev\/hdc1<\/em><\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3; margin-left: 54pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-style: italic;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">\u2022<\/span>&nbsp;<\/span><em>echo -n 6666666 &gt; \/proc\/sys\/dev\/raid\/speed_limit_max (this increases the rebuild speed)<\/em><\/div>\n<\/div>\n<\/div>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><strong> <span style=\"text-decoration: underline;\">How to rebuild a failed drive in software if you replace<\/span><span style=\"text-decoration: underline;\">d<\/span><span style=\"text-decoration: underline;\"> the drive<\/span><span style=\"text-decoration: underline;\">:<\/span><\/strong><\/p>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3; margin-left: 54pt;\">\n<p><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-style: italic; color: #000000;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">\u2022<\/span>&nbsp;<\/span><em>cat \/proc\/mdstat<\/em><\/p>\n<p><span style=\"color: #00b050;\">md2 : active raid1 hda3[0] hdc3[1]<\/span><br \/>\n<span style=\"color: #00b050;\"> 524096 blocks [2\/2] [UU]<\/span><br \/>\n<span style=\"color: #00b050;\">md1 : active raid1 hda2[0] hdc2[1]<\/span><br \/>\n<span style=\"color: #00b050;\"> 524096 blocks [2\/2] [UU]<\/span><br \/>\n<span style=\"color: #ff0000;\">md0 : active raid1 hda1[0]<\/span><br \/>\n<span style=\"color: #ff0000;\"> 78994304 blocks [2\/1] [U_]<\/span><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\">2. recreate the paritions on the new drive by doing the following, using the same mirror drive designations from \/proc\/mdstat.<\/p>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0; padding-bottom: 0; line-height: 1.3; margin-left: 54pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-style: italic; color: #000000;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">\u2022<\/span>&nbsp;<\/span><em>sfdisk -d \/dev\/hda(source) | sfdisk \/dev\/hdc(destination) (this duplicates all three partitions on the drive on the new drive)<\/em><\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3; margin-left: 54pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-style: italic; color: #000000;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">\u2022<\/span>&nbsp;<\/span><em> echo 6666666666 &gt; \/proc\/sys\/dev\/raid\/speed_limit_max (increase rebuild speed)<\/em><\/div>\n<\/div>\n<\/div>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\">3. Next check the partition by running<\/p>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0; padding-bottom: 0; line-height: 1.3; margin-left: 54pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-style: italic; color: #000000;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">\u2022<\/span>&nbsp;<\/span><em>df -h <\/em><\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3; margin-left: 54pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; color: #000000;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">\u2022<\/span>&nbsp;<\/span><em>fdisk -l<\/em><\/div>\n<\/div>\n<\/div>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Disk \/dev\/hdc: 81.9 GB, 81964302336 bytes<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">16 heads, 63 sectors\/track, 158816 cylinders<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Units = cylinders of 1008 * 512 = 516096 bytes<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Device Boot Start End Blocks Id System<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">\/dev\/hdc1 * 1 156735 78994408+ fd Linux raid autodetect<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">\/dev\/hdc2 156736 157775 524160 fd Linux raid autodetect<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">\/dev\/hdc3 157776 158815 524160 fd Linux raid autodetect<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Disk \/dev\/hda: 81.9 GB, 81964302336 bytes<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">16 heads, 63 sectors\/track, 158816 cylinders<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Units = cylinders of 1008 * 512 = 516096 bytes<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Device Boot Start End Blocks Id System<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">\/dev\/hda1 * 1 156735 78994408+ fd Linux raid autodetect<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">\/dev\/hda2 156736 157775 524160 fd Linux raid autodetect<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">\/dev\/hda3 157776 158815 524160 fd Linux raid autodetect<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">Filesystem Size Used Avail Use% Mounted on<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">\/dev\/md0 75G 11G 60G 16% \/<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">none 251M 0 251M 0% \/dev\/shm<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0pt; padding-bottom: 0; line-height: 1.2;\">\/dev\/md1 496M 8.1M 463M 2% \/tmp<\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\">4. Next you want it rebuild the partitions on the new drive so run the following, you will need to update your drive designation according to your drive assignment.<\/p>\n<div class=\"ul\" style=\"margin: 0;\">\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 0; padding-bottom: 0; line-height: 1.3; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-style: italic; color: #000000;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">\u2022<\/span>&nbsp;<\/span><em>raidhotadd \/dev\/md0 \/dev\/hdc1<\/em><\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-bottom: 0; padding-bottom: 0; line-height: 1.3; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-style: italic; color: #000000;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">\u2022<\/span>&nbsp;<\/span><em>raidhotadd \/dev\/md1 \/dev\/hdc2<\/em><\/div>\n<\/div>\n<div class=\"li\" style=\"margin: 0;\">\n<div style=\"margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3; margin-left: 36pt;\"><span style=\"display: inline-block; position: relative; text-indent: -18pt; font-style: italic; color: #000000;\"><span style=\"position: absolute; top: -0.34em; left: 0; font-size: 2em;\">\u2022<\/span>&nbsp;<\/span><em>raidhotadd \/dev\/md2 \/dev\/hdc3<\/em><\/div>\n<\/div>\n<\/div>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><span style=\"display: inline-block; height: 1em;\"><span style=\"display: none;\">.<\/span><\/span><\/p>\n<p style=\"margin-top: 0pt; padding-top: 0; margin-bottom: 8pt; padding-bottom: 0; line-height: 1.3;\"><strong><em>Note: the primary partition should match the new drive designation &#8216;dev\/md0 \/dev\/hdc1&#8217;.<\/em><\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Now I know nobody uses this kind of raid technology anymore, but it was one of the cool things I learned from my mentor at the time, when I first started my career centuries ago. I happen to find this in my archives and thought I would write up to share. There is another way to do this as using<a href=\"https:\/\/nicktailor.com\/tech-blog\/how-to-rebuild-a-drive-thats-fallen-out-of-software-raid\/\" class=\"read-more\">Read More &#8230;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[138,127],"tags":[],"class_list":["post-1090","post","type-post","status-publish","format-standard","hentry","category-linux","category-linux-software-raid-stuff"],"_links":{"self":[{"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/posts\/1090","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/comments?post=1090"}],"version-history":[{"count":14,"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/posts\/1090\/revisions"}],"predecessor-version":[{"id":1593,"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/posts\/1090\/revisions\/1593"}],"wp:attachment":[{"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/media?parent=1090"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/categories?post=1090"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nicktailor.com\/tech-blog\/wp-json\/wp\/v2\/tags?post=1090"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}