Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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