Page 1 of 3 123 LastLast
Results 1 to 10 of 26

Thread: Repair Degraded Raid 5 w/ mdadm

  1. #1
    Join Date
    Apr 2006
    Beans
    136

    Repair Degraded Raid 5 w/ mdadm

    One of my drives got kicked out of the array and I want to put it back into it, relevant info is below... Drives are sd[abcd]1

    Code:
    me@me:~$ sudo mdadm --detail /dev/md0 
    /dev/md0:
            Version : 00.90
      Creation Time : Tue May 12 23:47:18 2009
         Raid Level : raid5
         Array Size : 2197715712 (2095.91 GiB 2250.46 GB)
      Used Dev Size : 732571904 (698.64 GiB 750.15 GB)
       Raid Devices : 4
      Total Devices : 3
    Preferred Minor : 0
        Persistence : Superblock is persistent
    
        Update Time : Sat Oct 17 13:43:25 2009
              State : clean, degraded
     Active Devices : 3
    Working Devices : 3
     Failed Devices : 0
      Spare Devices : 0
    
             Layout : left-symmetric
         Chunk Size : 64K
    
               UUID : 55291172:b3b9b755:10f5c018:28823fe1 (local to host me)
             Events : 0.2184174
    
        Number   Major   Minor   RaidDevice State
           0       8        1        0      active sync   /dev/sda1
           1       8       17        1      active sync   /dev/sdb1
           2       0        0        2      removed
           3       8       49        3      active sync   /dev/sdd1
    Code:
    me@me:~$ cat /proc/mdstat 
    Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] 
    md0 : active raid5 sda1[0] sdd1[3] sdb1[1]
          2197715712 blocks level 5, 64k chunk, algorithm 2 [4/3] [UU_U]
          
    unused devices: <none>
    Can anyone offer some advice to get the drive back into the array (A rebuild of the array is fine)... I actually would like to check this drive before putting it back into the array (wiping it). So assume I want to put this drive back in as a NEW drive.

  2. #2
    Join Date
    Feb 2007
    Location
    Cameron Park CA USA
    Beans
    4,571
    Distro
    Ubuntu Development Release

    Re: Repair Degraded Raid 5 w/ mdadm

    Well, I can't say why the drive dropped out of the array.

    You zero the superblock of the drive and then add it back in... it will then auto re-sync itself using all four drives.

    First, fault the drive, then remove it:

    Code:
    sudo mdadm /dev/md0 -f /dev/sdc1
    
    sudo mdadm /dev/md0 -r /dev/sdc1
    
    sudo mdadm --zero-superblock /dev/sdc1
    
    sudo mdadm --manage -a /dev/md0 /dev/sdc1
    That should do it.
    Regards, frank, at http://yantrayoga.typepad.com/noname/
    Homebuilt Lian-Li PC-Q33WB, Intel i7-4790K 4.6GHz, SSDs,32G RAM | Dell Laptop 13.3".
    Oracle VBox w/ WinXP/Win10 running Xara Designer, PaintShopPro, and InDesign CS.

  3. #3
    Join Date
    Mar 2009
    Beans
    7

    Re: Repair Degraded Raid 5 w/ mdadm

    When one of my drive is pop out after a restart.
    I just "sudo mdadm --manage --re-add /dev/md0 /dev/sdc1"
    and it just resync

  4. #4
    Join Date
    Feb 2007
    Location
    Cameron Park CA USA
    Beans
    4,571
    Distro
    Ubuntu Development Release

    Re: Repair Degraded Raid 5 w/ mdadm

    Quote Originally Posted by citium View Post
    When one of my drive is pop out after a restart.
    I just "sudo mdadm --manage --re-add /dev/md0 /dev/sdc1"
    and it just resync
    That works if the added drive is a good one... we think the drive is not good.
    Regards, frank, at http://yantrayoga.typepad.com/noname/
    Homebuilt Lian-Li PC-Q33WB, Intel i7-4790K 4.6GHz, SSDs,32G RAM | Dell Laptop 13.3".
    Oracle VBox w/ WinXP/Win10 running Xara Designer, PaintShopPro, and InDesign CS.

  5. #5
    Join Date
    Apr 2006
    Beans
    136

    Re: Repair Degraded Raid 5 w/ mdadm

    Turns out the drive I had was bad, lots of reallocated sectors so I sent it in for RMA... I should be getting my new drive soon.

    So if I'm adding a new drive, what would be the exact command?

    (Thanks for the other commmands, those will come in handy down the line!)

  6. #6
    Join Date
    Feb 2007
    Location
    Cameron Park CA USA
    Beans
    4,571
    Distro
    Ubuntu Development Release

    Re: Repair Degraded Raid 5 w/ mdadm

    Exact command, can't say. You array is still set to be four drives I would think that you would make the filesystem on your new drive the same size and type as the others, using gparted or the like. Then simply add the new drive in:

    Code:
    sudo mdadm /dev/md0 -a /dev/sdc1
    It should start it sync adding the new drive. You can watch the process with:

    Code:
    sudo watch cat /proc/mdstat
    Let us know how things go. Thanks!
    Regards, frank, at http://yantrayoga.typepad.com/noname/
    Homebuilt Lian-Li PC-Q33WB, Intel i7-4790K 4.6GHz, SSDs,32G RAM | Dell Laptop 13.3".
    Oracle VBox w/ WinXP/Win10 running Xara Designer, PaintShopPro, and InDesign CS.

  7. #7
    Join Date
    Apr 2006
    Beans
    136

    Re: Repair Degraded Raid 5 w/ mdadm

    Finally got my drive, and finally got to use the above commands to get my raid back in order.

    Gonna let it resync on this drive, then test it for bad sectors/problems... and actually back it all up and recreate it with an ext4 system instead

    Thanks for the help!

  8. #8
    Join Date
    Feb 2007
    Location
    Cameron Park CA USA
    Beans
    4,571
    Distro
    Ubuntu Development Release

    Re: Repair Degraded Raid 5 w/ mdadm

    Pray, do tell how the ext4 works for you...

    Thanks!
    Regards, frank, at http://yantrayoga.typepad.com/noname/
    Homebuilt Lian-Li PC-Q33WB, Intel i7-4790K 4.6GHz, SSDs,32G RAM | Dell Laptop 13.3".
    Oracle VBox w/ WinXP/Win10 running Xara Designer, PaintShopPro, and InDesign CS.

  9. #9
    Join Date
    Apr 2006
    Beans
    136

    Re: Repair Degraded Raid 5 w/ mdadm

    Well in 9.04 I had corruption issues... but im willing to give it a try once again...

    can I just format my mdadm or do I need to recreate the whole array?

    Code:
    mkfs -t ext4 /dev/md0
    Will re-creating the array from scratch yield better performance then the above command? I never understood why I have to create a partition on each drive, set the boot flags, and then create the array... because after, it seems I still have to format the drives anyway and pick my filesystem...

    Why do people recommend creating the partitions first with gparted or the like, and then create the array which seems to wipe them anyway?

    Also, do I need to create the partitions or can I just create the array using the devices themselves (sda,sdb,sdc,sdd) instead of (sda1,sdb1,sdc1,sdd1)?

  10. #10
    Join Date
    Feb 2007
    Location
    Cameron Park CA USA
    Beans
    4,571
    Distro
    Ubuntu Development Release

    Re: Repair Degraded Raid 5 w/ mdadm

    You might try formatting the complete array without going through a complete --create as usual.

    I've always used one partition for the whole drive... that's the way I learned. Try it your way and see what happens.

    Let me know how things go.
    Regards, frank, at http://yantrayoga.typepad.com/noname/
    Homebuilt Lian-Li PC-Q33WB, Intel i7-4790K 4.6GHz, SSDs,32G RAM | Dell Laptop 13.3".
    Oracle VBox w/ WinXP/Win10 running Xara Designer, PaintShopPro, and InDesign CS.

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •