How to repair an unreadable sector of a disk belonging to a RAIDS

Asked by geole0

Hello
It may happen that a sector of a disk becomes unreadable. When this disc does not belong to a raid the recommended method is to do the following command

  sudo hdparm --yes-i-know-what-i-am-doing --write-sector nnnnnnnnn /dev/sdX

which puts zeros in this sector by reallocating it.

When this disc belongs to a RAIDS, I think it is possible to do a lot better than putting zeros since it should be possible to recover the true value by reading the other discs in the raids.

Unfortunately I don't know the MDADM command that would do this. It must certainly exist. Otherwise, it is very regrettable not to know how to repair.

 The principle of the command could be to rewrite the sectors provided in a file or better, for it to know how to detect them itself (badblock).

I think doing these commands is not the correct answer to the problem
mdadm –fail /dev/md0 /dev/sdX
mdadm –remove /dev/md0 /dev/sdX
mdadm –add /dev/md0 /dev/sdX

See this discussion https://forum.ubuntu-fr.org/viewtopic.php?pid=22410920#p22410920

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu mdadm Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Bernard Stafford (bernard010) said :
#1

The commands that you posted are to fail a drive then remove a drive.
That would not do anything for the bad sectors in a drive.
Unless you have a drive completely failed.
https://askubuntu.com/questions/241944/how-to-fix-the-hard-drive-bad-sector
https://www.maketecheasier.com/recover-data-and-partitions-for-free-with-testdisk/
https://packages.ubuntu.com/focal/testdisk
sudo apt-get install testdisk

Can you help with this problem?

Provide an answer of your own, or ask geole0 for more information if necessary.

To post a message you must log in.