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

Asked by geole0 on 2021-02-01

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

Question information

English Edit question
Ubuntu mdadm Edit question
No assignee Edit question
Last query:
Last reply:
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.
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.