I have a Linux mdadm RAID 10 array comprising of 6 (SATA) disks configured with n2 copies.

While pulling out one disk, another one in another mirror pair failed. Leaving me with:

$ cat /proc/mdstat
md2 : active raid10 sdb1[1] sdd1[5] sdc1[3] sdf1[2]
  2929412352 blocks 64K chunks 2 near-copies [6/4] [_UUU_U]

I wanted to replace the 5th disk and rebuilt the partition table with: sfdisk -d /dev/sdf | sfdisk /dev/sde

However, when I add the new disk with mdadm -a /dev/md1 /dev/sde1, mdadm starts to rebuild RaidDevice 0

$ mdadm -D /dev/md2
Number   Major   Minor   RaidDevice State
   6       8       66        0      spare rebuilding   /dev/sde1
   1       8        2        1      active sync   /dev/sdb1
   2       8       17        2      active sync   /dev/sdc1
   3       8       33        3      active sync   /dev/sdd1
   4       0        0        4      removed
   5       8       49        5      active sync   /dev/sdf1

This is not a major issue and I just need to physically move disk 5 to the disk 1 slot to maintain some sanity when looking at the box.

My question is, is there a way to instruct mdadm to use a new disk to replace a specific RaidDevice? I've trawled the man pages but can't find a suitable option.


I don`t saw such option even on hardware raid controllers. You can add hot spares only for some raid, but not for specified disk. Maybe, some controllers do that thing, but not all...

As far as i known, mdadm don`t have such option too. But you can try to do such trick: make dump of superblock(metadata) target failed disk (sde?) and upload it to your spare-disk. Maybe, --re-add option is do what you want, but im not sure.

from man: --re-add re-add a device that was previous removed from an array. If the metadata on the device reports that it is a member of the array, and the slot that it used is still vacant, then the device will be added back to the array in the same position.

| improve this answer | |
  • Please BE VERY CAREFUL WITH THIS: if the array has a write-intent bitmap, re-adding a new device only resyncs the changed bits: if you are adding a new empty disk, and try to fool the system pretending that the newly added disk is instead one of the known ones, what you'll get is that the resync will be super-fast, but the disk will be mostly full of garbage data! So, be sure to remove any bitmap (mdadm -G /dev/md0 --bitmap=none) before even trying this solution! – gog Jan 15 at 10:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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