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
1 Answer 1
I have read the post: https://unix.stackexchange.com/a/784321/30851. Thanks for frostschutz.
In:
mdadm --assemble /dev/mdX --update=force-no-bbl /dev/sd...
The --update=force-no-bbl
does allow the array to be reassembled.
Even though this will cause mdadm --examine-badblocks sdb
to return:
No bad-blocks list configured on /dev/sdb1
instead of on the new sdx disk:
Bad-blocks list is empty in /dev/sdx1
I don't know what the consequences of this are, but it does work.
-
If you want a new (empty) bad block list you can repeat the process with
--update=bbl
frostschutz– frostschutz2024年11月26日 23:13:33 +00:00Commented Nov 26, 2024 at 23:13
--zero-superblock
didn't work as expected leaving some garbage in sensitive areas, so zeroing manually withdd of=/dev/sdb4 if=/dev/zero bs=1M count=1
solved the problem and--add
worked exactly as expected reference.