mdadm: failed to write superblock-Collection of common programming errors
I’m quite new to RAID, and I’m having a problem. My server warned me that some drive is faulty, so I investigated:
root@server:~# cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath] [faulty]
md1 : active raid1 sda1[2](F) sdb1[1]
10485696 blocks [2/1] [_U]
md2 : active raid1 sda2[2](F) sdb2[1]
965746624 blocks [2/1] [_U]
unused devices:
It looks like that sda1 and sda2 are faulty. So I tried to remove sda1
root@server:~# mdadm /dev/md1 -r /dev/sda1
mdadm: hot removed /dev/sda1 from /dev/md1
I’m trying to understand what should I do now: if I try to add the device again I get this message:
root@server:~# mdadm /dev/md1 -a /dev/sda1
mdadm: failed to write superblock to /dev/sda1
I suppose I’m missing some rebuilding/restore step. How can I restore the RAID system again?
UPDATE:
dmesg output shows a lot of these, so there’s some evidence of hardware failure:
sd 0:0:0:0: [sda] Unhandled error code
sd 0:0:0:0: [sda] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
sd 0:0:0:0: [sda] CDB: Read(10): 28 00 00 00 10 07 00 00 01 00
end_request: I/O error, dev sda, sector 4103
-
mdadm has marked the drive as faulty and your log is showing errors on the drive.
This means the drive is broken and has to be replaced. There’s no point in readding it to the RAID.