2

Received a message that RAID went into degraded state:

Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md0 : active raid1 sda1[0] sdb1[1]
      524224 blocks [2/2] [UU]

md2 : active raid10 sda5[0] sdb5[1] sdd5[3] sdc5[2](F)
      1128864768 blocks super 1.2 512K chunks 2 near-copies [4/3] [UU_U]

md1 : active raid10 sda2[0] sdb2[1] sdc2[2] sdd2[3]
      41909248 blocks super 1.2 512K chunks 2 near-copies [4/4] [UUUU]

unused devices: <none>

Logged in to the server and removed fail disk (didn't mark it as failed):

#> mdadm --manage /dev/md2 --remove /dev/sdc5

Here is current status:

#> cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] 
md0 : active raid1 sda1[0] sdb1[1]
      524224 blocks [2/2] [UU]

md2 : active raid10 sda5[0] sdb5[1] sdd5[3]
      1128864768 blocks super 1.2 512K chunks 2 near-copies [4/3] [UU_U]

md1 : active raid10 sda2[0] sdb2[1] sdc2[2] sdd2[3]
      41909248 blocks super 1.2 512K chunks 2 near-copies [4/4] [UUUU]

unused devices: <none>

And more details:

#> mdadm --detail /dev/md2
/dev/md2:
        Version : 1.2
  Creation Time : Sun Apr  6 13:42:43 2014
     Raid Level : raid10
     Array Size : 1128864768 (1076.57 GiB 1155.96 GB)
  Used Dev Size : 564432384 (538.28 GiB 577.98 GB)
   Raid Devices : 4
  Total Devices : 3
    Persistence : Superblock is persistent

    Update Time : Wed Jun  3 10:29:14 2015
          State : active, degraded 
 Active Devices : 3
Working Devices : 3
 Failed Devices : 0
  Spare Devices : 0

         Layout : near=2
     Chunk Size : 512K

           Name : yyc-controller:2
           UUID : c9fe371a:2c8345bf:68054eba:bb4d78aa
         Events : 41545

    Number   Major   Minor   RaidDevice State
       0       8        5        0      active sync   /dev/sda5
       1       8       21        1      active sync   /dev/sdb5
       2       0        0        2      removed
       3       8       53        3      active sync   /dev/sdd5

Now I'm trying add it back but it fails:

#> mdadm --manage /dev/md2 --add /dev/sdc5
mdadm: add new device failed for /dev/sdc5 as 4: Invalid argument

How can I add disk as Number 2 instead of removed?

5
  • Did you confirm that the disk is actually good? There's a reason it went into a degraded state, you know.
    – Nathan C
    Jun 3, 2015 at 17:19
  • Disk sdc2 (which is just a different partition of the same disk) part of the md1 array. So I assume it should be good. Any suggestions how to check it?
    – user270199
    Jun 3, 2015 at 17:25
  • 1
    That isn't at all how RAID should be configured ...why do you have RAID over one disk?
    – Nathan C
    Jun 3, 2015 at 17:26
  • Why not? I think it was setup in purpose (not by me). I just need to re-add it back to the RAID
    – user270199
    Jun 3, 2015 at 17:40
  • Nathan, you were right - disk was broken. That's why I couldn't add it to array. md1 didn't degrade because it wasn't in use (it is a swap partition).
    – user270199
    Jun 5, 2015 at 16:37

2 Answers 2

1

I had a similar issue. One disk of a raid1 had some issues and I had removed the entire disk from the raid. After a destructive badblocks check writing random patterns, three of the four partitions of the disk could be added back to the raid without problems. Only the last partition failed with the above error. syslog reported:

md: sdb4 does not have a valid v1.2 superblock, not importing!

I didn't want to stop the raid and completely rebuild it, as sometimes suggested, but I could fix this by zeroing out the random patterns, where mdadm seemd to find some superblock like bytes using dd:

dd of=/dev/sdb4 if=/dev/zero bs=1M count=1

Afterwards mdadm could add the partition without errors.

1
  • tried that before without bs=1M count=1, failed with, success, thanks
    – benba
    Sep 25, 2021 at 21:02
0

If it's indeed the same drive/partition, you can use the --re-add switch, like so: mdadm --manage /dev/md1 --re-add /dev/sdc5. See this for more information on how it works. I highly recommend a good backup before messing with it.

2
  • Unfortunately this is doesn't work: mdadm: --re-add for /dev/sdc5 to /dev/md2 is not possible
    – user270199
    Jun 3, 2015 at 17:54
  • This one is fails as well: #> mdadm --zero-superblock /dev/sdc5 mdadm: Unrecognised md component device - /dev/sdc5
    – user270199
    Jun 3, 2015 at 17:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.