I’m sure there used to be a thing called raidhotadd, anyway these days it seems to be mdadm. We have a few machines with software raid, and very occasionally a md device flags a disk as dead but adding it back into the array fixes the problem.

Anyway, I never remember this, so to remove and then re-add a disk from a md device do the following:

[root@host ~]# cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 sdb1[1] sda1[0]
104320 blocks [2/2] [UU]`

`md0 : active raid1 sdc1[0] sdd1[2](F)
143371968 blocks [2/1] [U_]
md2 : active raid1 sdb2[1] sda2[0]
71577536 blocks [2/2] [UU]
unused devices:
[root@host ~]# fdisk -l /dev/sdd
Disk /dev/sdd: 146.8 GB, 146815737856 bytes
255 heads, 63 sectors/track, 17849 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot      Start         End      Blocks   Id  System
/dev/sdd1   *           1       17849   143372061   fd  Linux raid autodetect
[root@host ~]# mdadm /dev/md0 --remove /dev/sdd1
mdadm: hot removed /dev/sdd1
[root@host ~]# mdadm /dev/md0 --add /dev/sdd1
mdadm: re-added /dev/sdd1
[root@host ~]# cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 sdb1[1] sda1[0]
104320 blocks [2/2] [UU]
md0 : active raid1 sdd1[2] sdc1[0]
143371968 blocks [2/1] [U_]
[>....................]  recovery =  0.2% (297280/143371968) finish=32.0min speed=74320K/sec
md2 : active raid1 sdb2[1] sda2[0]
71577536 blocks [2/2] [UU]
unused devices:
[root@host ~]#

And there we can see from /proc/mdstat that the md device will be synchronised and happy again soon.