{"id":3132,"date":"2020-05-17T00:00:00","date_gmt":"2020-05-16T18:30:00","guid":{"rendered":"https:\/\/www.24x7serversupport.com\/blog\/?p=3132"},"modified":"2023-01-28T12:32:23","modified_gmt":"2023-01-28T07:02:23","slug":"linux-raid-with-mdadm-cheat-sheet","status":"publish","type":"post","link":"https:\/\/www.24x7serversupport.com\/blog\/linux-raid-with-mdadm-cheat-sheet\/","title":{"rendered":"Linux RAID with mdadm Cheat Sheet"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\" id=\"title_17725_68003\">RAID Levels<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>RAID 0<\/td><td><strong>Stri\u00adpes<\/strong> data evenly across two or more disks.<\/td><\/tr><tr><td>RAID 1<\/td><td><strong>Mirr\u00adors<\/strong> data on two or more disks.<\/td><\/tr><tr><td>RAID 2<\/td><td>Rarely used, Bit-level striping with Hamming code for error correc\u00adtion.<\/td><\/tr><tr><td>RAID 3<\/td><td>Rarely used, byte-level striping with a dedicated parity.<\/td><\/tr><tr><td>RAID 4<\/td><td>Block-\u00adlevel striping with <strong>dedi\u00adcated parity<\/strong>.<\/td><\/tr><tr><td>RAID 5<\/td><td>Block-\u00adlevel striping with <strong>dist\u00adributed parity<\/strong>.<\/td><\/tr><tr><td>RAID 6<\/td><td>Block-\u00adlevel striping with <strong>double distri\u00adbuted parity<\/strong>.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"title_17725_68038\">Nested RAID Levels<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Number<\/strong><\/td><td><strong>Desc\u00adrip\u00adtion<\/strong><\/td><td><strong>Efficiency<\/strong><\/td><\/tr><tr><td>RAID 01<\/td><td>Block-\u00adlevel striping, and mirroring without parity<\/td><td>1\/stripes<\/td><\/tr><tr><td>RAID 10<\/td><td>Mirroring without parity, and block-\u00adlevel striping<\/td><td>stripes\/n<\/td><\/tr><tr><td>RAID 50<\/td><td>Block-\u00adlevel striping with distri\u00adbuted parity, and block-\u00adlevel striping<\/td><td>(1-str\u00adipes)\/n<\/td><\/tr><tr><td>RAID 60<\/td><td>Block-\u00adlevel striping with double distri\u00adbuted parity, and block-\u00adlevel striping<\/td><td>(1-2*s\u00adtri\u00adpes)\/n<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"title_17725_68029\">Formatting Disks for Use with mdadm<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>DISC\u00adLAIMER: PROCEED WITH CAUTION.<\/strong><\/td><\/tr><tr><td>MAKE SURE YOU KNOW WHAT DISK YOU ARE OPERATING ON. IT IS VERY EASY TO DO IRREVO\u00adCABLE DAMAGE TO YOUR SYSTEM IF YOU DON&#8217;T.<\/td><\/tr><tr><td><strong>0. Figure out disk location in the file system:<\/strong><\/td><\/tr><tr><td><code>lsblk -o name,s\u00adize\u00ad,fs\u00adtyp\u00ade,t\u00adype\u00ad,mo\u00adunt\u00adpoint<\/code><\/td><\/tr><tr><td><strong>1. Formatting with fdisk<\/strong><\/td><\/tr><tr><td><code>sudo fdisk \/dev\/sdx<\/code><\/td><\/tr><tr><td><strong>2. Navigatng fdisk: just press the following keys when promted to create new linux RAID type primary partition<\/strong><\/td><\/tr><tr><td><code>n<\/code>, <code>p<\/code>, <code>1<\/code>, <code>Enter<\/code>, <code>Enter<\/code>, <code>t<\/code>, <code>fd<\/code>, <code>w<\/code><\/td><\/tr><tr><td><strong>3. Repeat steps 1 and 2 for each disk that will be included in new array<\/strong><\/td><\/tr><tr><td><code>sudo fdisk \/dev\/sdy<\/code><\/td><\/tr><tr><td><code>n<\/code>, <code>p<\/code>, <code>1<\/code>, <code>Enter<\/code>, <code>Enter<\/code>, <code>t<\/code>, <code>fd<\/code>, <code>w<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"title_17725_68001\">Creating RAID arrays<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Create a mirrored array<\/strong><\/td><\/tr><tr><td>mdadm &#8211;create \/dev\/md0 &#8211;level=1 \/dev\/sdx1 \/dev\/sdy1<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"title_17725_68035\">Assembling RAID arrays<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Assemble an existing array<\/strong><\/td><\/tr><tr><td><code>mdadm --assemble \/dev\/md0 \/dev\/sdx1 \/dev\/sdy1<\/code><\/td><\/tr><tr><td><code>mdadm --scan --assemble --uuid=&lt;UUID&gt;<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"title_17725_68040\">Resetting Existing RAID Devices<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Find the active arrays<\/strong><\/td><\/tr><tr><td><code>cat \/proc\/\u00admdstat<\/code><\/td><\/tr><tr><td><strong>Unmount the array<\/strong><\/td><\/tr><tr><td><code>sudo umount \/dev\/md0<\/code><\/td><\/tr><tr><td><strong>Stop and remove the array<\/strong><\/td><\/tr><tr><td><code>mdadm --stop \/dev\/md0<\/code><\/td><\/tr><tr><td><code>mdadm --remove \/dev\/md0<\/code><\/td><\/tr><tr><td><strong>Find the devices used to build the array<\/strong><\/td><\/tr><tr><td><code>lsblk -o name,f\u00adsty\u00adpe,\u00admou\u00adntp\u00adoint<\/code><\/td><\/tr><tr><td><strong>Zero out the respective superb\u00adlocks<\/strong><\/td><\/tr><tr><td><code>sudo mdadm --zero\u00ad-su\u00adper\u00adblock \/dev\/sdx<\/code><\/td><\/tr><tr><td><code>sudo mdadm --zero\u00ad-su\u00adper\u00adblock \/dev\/sdy<\/code><\/td><\/tr><tr><td><strong>Remove persistent references to the array<\/strong><\/td><\/tr><tr><td><code>sudo nano \/etc\/f\u00adstab<\/code><\/td><\/tr><tr><td>Comment out or remove the reference to the array.<\/td><\/tr><tr><td><code># \/dev\/md0 \/mnt\/md0 ext4 defaults,nofail,discard 0 0<\/code><\/td><\/tr><tr><td>In <code>\/etc\/\u00admda\u00addm\/\u00admda\u00addm.c\u00adonf<\/code> comment out or remove the array reference<\/td><\/tr><tr><td><code>sudo nano \/etc\/m\u00addad\u00adm\/m\u00addad\u00adm.conf<\/code><\/td><\/tr><tr><td>Comment out the reference<\/td><\/tr><tr><td><code># ARRAY \/dev\/md0 metada\u00adta=1.2 name=m\u00addad\u00admwr\u00adite:0 UUID=xxxx<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>RAID Levels RAID 0 Stri\u00adpes data evenly across two or more disks. RAID 1 Mirr\u00adors data on two or more disks. RAID 2 Rarely used, Bit-level striping with Hamming code for error correc\u00adtion. RAID 3 Rarely used, byte-level striping with a dedicated parity. RAID 4 Block-\u00adlevel striping with dedi\u00adcated parity. RAID 5 Block-\u00adlevel striping with [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3599,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[30,38,238],"tags":[257,319,318,76,320],"class_list":["post-3132","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","category-cloudlinux","category-cwp","tag-cheatsheet","tag-linuxcheatsheet","tag-madam","tag-raid","tag-raidcheatsheet"],"jetpack_publicize_connections":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Linux RAID with mdadm Cheat Sheet | 24x7serversupport Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.24x7serversupport.com\/blog\/linux-raid-with-mdadm-cheat-sheet\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Linux RAID with mdadm Cheat Sheet | 24x7serversupport Blog\" \/>\n<meta property=\"og:description\" content=\"RAID Levels RAID 0 Stri\u00adpes data evenly across two or more disks. RAID 1 Mirr\u00adors data on two or more disks. RAID 2 Rarely used, Bit-level striping with Hamming code for error correc\u00adtion. RAID 3 Rarely used, byte-level striping with a dedicated parity. RAID 4 Block-\u00adlevel striping with dedi\u00adcated parity. RAID 5 Block-\u00adlevel striping with [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.24x7serversupport.com\/blog\/linux-raid-with-mdadm-cheat-sheet\/\" \/>\n<meta property=\"og:site_name\" content=\"24x7serversupport Blog\" \/>\n<meta property=\"article:published_time\" content=\"2020-05-16T18:30:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-01-28T07:02:23+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.24x7serversupport.com\/blog\/wp-content\/uploads\/2020\/05\/LInux-RAID-Mdadm-Cheat-Sheet.png\" \/>\n\t<meta property=\"og:image:width\" content=\"667\" \/>\n\t<meta property=\"og:image:height\" content=\"580\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"24x7support\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@24x7serversuppo\" \/>\n<meta name=\"twitter:site\" content=\"@24x7serversuppo\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"24x7support\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/linux-raid-with-mdadm-cheat-sheet\/\",\"url\":\"https:\/\/www.24x7serversupport.com\/blog\/linux-raid-with-mdadm-cheat-sheet\/\",\"name\":\"Linux RAID with mdadm Cheat Sheet | 24x7serversupport Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/linux-raid-with-mdadm-cheat-sheet\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/linux-raid-with-mdadm-cheat-sheet\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/www.24x7serversupport.com\/blog\/wp-content\/uploads\/2020\/05\/LInux-RAID-Mdadm-Cheat-Sheet.png?fit=667%2C580&ssl=1\",\"datePublished\":\"2020-05-16T18:30:00+00:00\",\"dateModified\":\"2023-01-28T07:02:23+00:00\",\"author\":{\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/#\/schema\/person\/decfb5fad6bde6ac6822d4e965c6d401\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/linux-raid-with-mdadm-cheat-sheet\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.24x7serversupport.com\/blog\/linux-raid-with-mdadm-cheat-sheet\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/linux-raid-with-mdadm-cheat-sheet\/#primaryimage\",\"url\":\"https:\/\/i0.wp.com\/www.24x7serversupport.com\/blog\/wp-content\/uploads\/2020\/05\/LInux-RAID-Mdadm-Cheat-Sheet.png?fit=667%2C580&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/www.24x7serversupport.com\/blog\/wp-content\/uploads\/2020\/05\/LInux-RAID-Mdadm-Cheat-Sheet.png?fit=667%2C580&ssl=1\",\"width\":667,\"height\":580,\"caption\":\"Linux RAID with mdadm Cheat Sheet\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/linux-raid-with-mdadm-cheat-sheet\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.24x7serversupport.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Linux RAID with mdadm Cheat Sheet\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/#website\",\"url\":\"https:\/\/www.24x7serversupport.com\/blog\/\",\"name\":\"24x7serversupport Blog\",\"description\":\"Linux | CPanel | WHM | webhosting| Plesk | DirectAdmin | CentOs | Debian | Ubuntu Blog\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.24x7serversupport.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/#\/schema\/person\/decfb5fad6bde6ac6822d4e965c6d401\",\"name\":\"24x7support\",\"url\":\"https:\/\/www.24x7serversupport.com\/blog\/author\/24x7support\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Linux RAID with mdadm Cheat Sheet | 24x7serversupport Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.24x7serversupport.com\/blog\/linux-raid-with-mdadm-cheat-sheet\/","og_locale":"en_US","og_type":"article","og_title":"Linux RAID with mdadm Cheat Sheet | 24x7serversupport Blog","og_description":"RAID Levels RAID 0 Stri\u00adpes data evenly across two or more disks. RAID 1 Mirr\u00adors data on two or more disks. RAID 2 Rarely used, Bit-level striping with Hamming code for error correc\u00adtion. RAID 3 Rarely used, byte-level striping with a dedicated parity. RAID 4 Block-\u00adlevel striping with dedi\u00adcated parity. RAID 5 Block-\u00adlevel striping with [&hellip;]","og_url":"https:\/\/www.24x7serversupport.com\/blog\/linux-raid-with-mdadm-cheat-sheet\/","og_site_name":"24x7serversupport Blog","article_published_time":"2020-05-16T18:30:00+00:00","article_modified_time":"2023-01-28T07:02:23+00:00","og_image":[{"width":667,"height":580,"url":"https:\/\/www.24x7serversupport.com\/blog\/wp-content\/uploads\/2020\/05\/LInux-RAID-Mdadm-Cheat-Sheet.png","type":"image\/png"}],"author":"24x7support","twitter_card":"summary_large_image","twitter_creator":"@24x7serversuppo","twitter_site":"@24x7serversuppo","twitter_misc":{"Written by":"24x7support","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.24x7serversupport.com\/blog\/linux-raid-with-mdadm-cheat-sheet\/","url":"https:\/\/www.24x7serversupport.com\/blog\/linux-raid-with-mdadm-cheat-sheet\/","name":"Linux RAID with mdadm Cheat Sheet | 24x7serversupport Blog","isPartOf":{"@id":"https:\/\/www.24x7serversupport.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.24x7serversupport.com\/blog\/linux-raid-with-mdadm-cheat-sheet\/#primaryimage"},"image":{"@id":"https:\/\/www.24x7serversupport.com\/blog\/linux-raid-with-mdadm-cheat-sheet\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/www.24x7serversupport.com\/blog\/wp-content\/uploads\/2020\/05\/LInux-RAID-Mdadm-Cheat-Sheet.png?fit=667%2C580&ssl=1","datePublished":"2020-05-16T18:30:00+00:00","dateModified":"2023-01-28T07:02:23+00:00","author":{"@id":"https:\/\/www.24x7serversupport.com\/blog\/#\/schema\/person\/decfb5fad6bde6ac6822d4e965c6d401"},"breadcrumb":{"@id":"https:\/\/www.24x7serversupport.com\/blog\/linux-raid-with-mdadm-cheat-sheet\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.24x7serversupport.com\/blog\/linux-raid-with-mdadm-cheat-sheet\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.24x7serversupport.com\/blog\/linux-raid-with-mdadm-cheat-sheet\/#primaryimage","url":"https:\/\/i0.wp.com\/www.24x7serversupport.com\/blog\/wp-content\/uploads\/2020\/05\/LInux-RAID-Mdadm-Cheat-Sheet.png?fit=667%2C580&ssl=1","contentUrl":"https:\/\/i0.wp.com\/www.24x7serversupport.com\/blog\/wp-content\/uploads\/2020\/05\/LInux-RAID-Mdadm-Cheat-Sheet.png?fit=667%2C580&ssl=1","width":667,"height":580,"caption":"Linux RAID with mdadm Cheat Sheet"},{"@type":"BreadcrumbList","@id":"https:\/\/www.24x7serversupport.com\/blog\/linux-raid-with-mdadm-cheat-sheet\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.24x7serversupport.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Linux RAID with mdadm Cheat Sheet"}]},{"@type":"WebSite","@id":"https:\/\/www.24x7serversupport.com\/blog\/#website","url":"https:\/\/www.24x7serversupport.com\/blog\/","name":"24x7serversupport Blog","description":"Linux | CPanel | WHM | webhosting| Plesk | DirectAdmin | CentOs | Debian | Ubuntu Blog","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.24x7serversupport.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.24x7serversupport.com\/blog\/#\/schema\/person\/decfb5fad6bde6ac6822d4e965c6d401","name":"24x7support","url":"https:\/\/www.24x7serversupport.com\/blog\/author\/24x7support\/"}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.24x7serversupport.com\/blog\/wp-content\/uploads\/2020\/05\/LInux-RAID-Mdadm-Cheat-Sheet.png?fit=667%2C580&ssl=1","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/posts\/3132","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/comments?post=3132"}],"version-history":[{"count":1,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/posts\/3132\/revisions"}],"predecessor-version":[{"id":3133,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/posts\/3132\/revisions\/3133"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/media\/3599"}],"wp:attachment":[{"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/media?parent=3132"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/categories?post=3132"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/tags?post=3132"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}