How do I reinitialise a failed RAID 5 drive using terminal on Ubuntu Server

Posted by Stephen on Super User See other posts from Super User or by Stephen
Published on 2012-06-19T07:12:02Z Indexed on 2012/06/19 9:19 UTC
Read the original article Hit count: 283

I've currently put together a new system and part of that has been creating a software RAID 5 using 'mdadm' in Ubuntu Server.

I successfully got to the point where I create the array using:

sudo mdadm --create --verbose /dev/md0 --level=5 --raid-devices=4 /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1

I left it to do its thing overnight then used the following command to check on it:

watch cat /proc/mdstat

To which the following was returned:

Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md0 : active raid5 sdd1[4](S) sdc1[2] sdb1[1] sda1[0](F)
      5860535808 blocks super 1.2 level 5, 512k chunk, algorithm 2 [4/2] [_UU_]

unused devices: <none>

It appears that one has failed (and I'm not too savvy with why another is a spare).

So, just to be sure that something else isn't amiss I wanted to try and re-engage the failed drive. Can someone explain how I can do that and what I should do with the spare (if anything).

And also how do I know when synchronisation is complete?

The tutorial I used to get this far is located here:

http://sonniesedge.co.uk/2009/06/13/software-raid-5-on-ubuntu-904/

Many thanks!

p.s. Here is some extra information that may help:

sudo mdadm --detail /dev/md0
/dev/md0:
        Version : 1.2
  Creation Time : Mon Jun 18 21:14:21 2012
     Raid Level : raid5
     Array Size : 5860535808 (5589.04 GiB 6001.19 GB)
  Used Dev Size : 1953511936 (1863.01 GiB 2000.40 GB)
   Raid Devices : 4
  Total Devices : 4
    Persistence : Superblock is persistent

    Update Time : Mon Jun 18 21:50:26 2012
          State : clean, FAILED 
 Active Devices : 2
Working Devices : 3
 Failed Devices : 1
  Spare Devices : 1

         Layout : left-symmetric
     Chunk Size : 512K

           Name : myraidbox:0  (local to host myraidbox)
           UUID : a269ee94:a161600c:fb1665e7:bd2f27b3
         Events : 13

    Number   Major   Minor   RaidDevice State
       0       0        0        0      removed
       1       8       17        1      active sync   /dev/sdb1
       2       8       33        2      active sync   /dev/sdc1
       3       0        0        3      removed

       0       8        1        -      faulty spare   /dev/sda1
       4       8       49        -      spare   /dev/sdd1

© Super User or respective owner

Related posts about ubuntu

Related posts about raid