I have a RAID1 array of two hard disks which recently lost one drive, but I can't seem to simply replace the broken one.
mdadm --detail has reported that the first drive slot sda has been removed (which it physically has) the second drive slot sdb is the one that is still working (active, sync).
The sdb was recently replaced, so the data is safe.
But when I try to add the disk with mdadm /dev/md127 --add /dev/sdx it returns an error:
$ sudo mdadm /dev/md127 --add /dev/sdx1
mdadm: add new device failed for /dev/sdx1 as 3: Invalid argument
dmesg shows these:
[ xx.xx] md: sdx1 does not have a valid v1.2 superblock, not importing!
[ xx.xx] md: md_import_device returned -22
I confirmed with parted that the partition size of sdx1 is exactly the same as sdb1 (sectors and byte).
Also after --add the drive, although an error occurs, lsblk shows that there is already metadata for the array on sda1.
Translated with DeepL
--zero-superblockdidn't work as expected leaving some garbage in sensitive areas, so zeroing manually withdd of=/dev/sdb4 if=/dev/zero bs=1M count=1solved the problem and--addworked exactly as expected reference.