{"id":132,"date":"2015-01-16T21:54:57","date_gmt":"2015-01-16T21:54:57","guid":{"rendered":"http:\/\/simon.aldrich.eu\/blog\/?p=132"},"modified":"2015-01-16T21:57:33","modified_gmt":"2015-01-16T21:57:33","slug":"removing-a-disk-from-a-raid-1-array","status":"publish","type":"post","link":"https:\/\/simon.aldrich.cc\/blog\/2015\/01\/removing-a-disk-from-a-raid-1-array\/","title":{"rendered":"Removing a disk from a RAID 1 array"},"content":{"rendered":"<p>I&#8217;m in the process of building a new NAS server to replace our existing one which is getting a bit long in the tooth. As usual I&#8217;ve opted to install Ubuntu Server LTS as the OS. In my current NAS I&#8217;ve got the system partition RAID 1&#8217;d across all the drives, this means that should one fail I&#8217;ve still got 4 copies.<\/p>\n<p>Setting up the new NAS I&#8217;ve put the system partition on a separate SSD from the main data drives. I&#8217;ve currently only got the one SSD but I wanted the option of RAID 1&#8217;ing the system drive for redundancy should I decide to get another SSD in future.<\/p>\n<p>The Ubuntu installer will quite happily let you create a RAID 1 MD device with 2 disks but only select a single drive to belong to it. This would be the equivalent of the following mdadm command:<br \/>\n<code><br \/>\nmdadm --create \/dev\/md2 --level=1 --raid-devices=2 \/dev\/loop1 missing<br \/>\n<\/code><br \/>\nHowever, when you boot the OS will consider that array degraded:<br \/>\n<code><br \/>\nmdadm -D \/dev\/md2<br \/>\n\/dev\/md2:<br \/>\nVersion : 1.2<br \/>\nCreation Time : Fri Jan 16 21:24:44 2015<br \/>\nRaid Level : raid1<br \/>\nArray Size : 32704 (31.94 MiB 33.49 MB)<br \/>\nUsed Dev Size : 32704 (31.94 MiB 33.49 MB)<br \/>\nRaid Devices : 2<br \/>\nTotal Devices : 1<br \/>\nPersistence : Superblock is persistent<\/p>\n<p>Update Time : Fri Jan 16 21:26:58 2015<br \/>\nState : clean, degraded<br \/>\nActive Devices : 1<br \/>\nWorking Devices : 1<br \/>\nFailed Devices : 0<br \/>\nSpare Devices : 0<\/p>\n<p>Name : lupin:2 (local to host lupin)<br \/>\nUUID : eccabf13:879f4196:1c47de11:3059e0b8<br \/>\nEvents : 6<\/p>\n<p>Number Major Minor RaidDevice State<br \/>\n0 7 1 0 active sync \/dev\/loop1<br \/>\n1 0 0 1 removed<br \/>\n<\/code><br \/>\nIt seems that you can&#8217;t remove the &#8220;missing&#8221; disk from the array even with<br \/>\n<code><br \/>\nmdadm \/dev\/md2 -r detached<br \/>\n<\/code><br \/>\nI eventually found the solution to this problem. It seems (counter-intuitively) that to remove a device from the array you have to &#8220;grow&#8221; that array as follows:<br \/>\n<code><br \/>\nmdadm \/dev\/md2 --grow --force --raid-devices=1<br \/>\n<\/code><br \/>\nThis resulted in the missing \/ removed \/ non-existent device being removed from the array and it being considered clean:<br \/>\n<code><br \/>\nmdadm -D \/dev\/md2<br \/>\n\/dev\/md2:<br \/>\nVersion : 1.2<br \/>\nCreation Time : Fri Jan 16 21:24:44 2015<br \/>\nRaid Level : raid1<br \/>\nArray Size : 32704 (31.94 MiB 33.49 MB)<br \/>\nUsed Dev Size : 32704 (31.94 MiB 33.49 MB)<br \/>\nRaid Devices : 1<br \/>\nTotal Devices : 1<br \/>\nPersistence : Superblock is persistent<\/p>\n<p>Update Time : Fri Jan 16 21:32:17 2015<br \/>\nState : clean<br \/>\nActive Devices : 1<br \/>\nWorking Devices : 1<br \/>\nFailed Devices : 0<br \/>\nSpare Devices : 0<\/p>\n<p>Name : lupin:2 (local to host lupin)<br \/>\nUUID : eccabf13:879f4196:1c47de11:3059e0b8<br \/>\nEvents : 11<\/p>\n<p>Number Major Minor RaidDevice State<br \/>\n0 7 1 0 active sync \/dev\/loop1<br \/>\n<\/code><br \/>\nThis took me a while to figure out so I hope this might help someone else out there who&#8217;s trying to achieve the same thing.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m in the process of building a new NAS server to replace our existing one which is getting a bit long in the tooth. As usual I&#8217;ve opted to install Ubuntu Server LTS as the OS. In my current NAS I&#8217;ve got the system partition RAID 1&#8217;d across all the drives, this means that should [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[5,28],"tags":[35,34],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p2Rw4E-28","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/simon.aldrich.cc\/blog\/wp-json\/wp\/v2\/posts\/132"}],"collection":[{"href":"https:\/\/simon.aldrich.cc\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/simon.aldrich.cc\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/simon.aldrich.cc\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/simon.aldrich.cc\/blog\/wp-json\/wp\/v2\/comments?post=132"}],"version-history":[{"count":2,"href":"https:\/\/simon.aldrich.cc\/blog\/wp-json\/wp\/v2\/posts\/132\/revisions"}],"predecessor-version":[{"id":134,"href":"https:\/\/simon.aldrich.cc\/blog\/wp-json\/wp\/v2\/posts\/132\/revisions\/134"}],"wp:attachment":[{"href":"https:\/\/simon.aldrich.cc\/blog\/wp-json\/wp\/v2\/media?parent=132"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/simon.aldrich.cc\/blog\/wp-json\/wp\/v2\/categories?post=132"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/simon.aldrich.cc\/blog\/wp-json\/wp\/v2\/tags?post=132"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}