Hi Gary, On Sun, Sep 20, 2026 at 08:45:12AM -0400, Gary Dale wrote: > 3. can you explain your use of hdparm? It's not obvious to me how to > use it as you described.
You need to use it with great care as if done wrong it will be destructive. Let's say you have a partition sda3 that you see I/O read errors from and the kernel logs tell you that they are happening at sector LBA 123987. If the sda3 partition is normally part of a RAID array that has redundancy then by definition you have a copy of sector 123987 elsewhere on the array. You can afford to lose that sector's contents from disk sda. 1. Make sure sda3 is not in an active arreay 2. Attempt to read sector 123987 with hdparm: # hdparm --read-sector 123987 /dev/sda If you prefer using "dd" instead, that would be: # dd if=/dev/sda bs=512 skip=123987 count=1 which is why I suggested that you try to read the whole device with "dd" earlier in this thread. Note it is "sda" and not "sda3" because the error logs will be showing you the sector number of the whole disk device. If hdparm can read the contents of the sector without error, then something weird is going on and you should stop here. This would indicate that there's not a problem with the drive but perhaps some software issue. On the other hand, if you can't read the sector and just continue to get IO errors then that data is already lost from sda and your goal now is to force the drive to stop using that sector. 3. Here's the destructive part. Write over the contents of sector 123987 with zeroes: # hdparm --write-sector 123987 --yes-i-know-what-i-am-doing /dev/sda If that fails, most likely the drive is severely damaged. If it works, the drive should have remapped the damaged sector to one of its spare sectors and stored the new (zero) data in there. You should now be able to repeat step 2 and successfully read (zero) data from that sector without issue. 4. Re-add sda3 to the array and let md overwrite it with data so you have redundancy again The thing about all of this is that there's no point doing it unless you're sure it's a hardware problem with the drive (one or more bad sectors). But once you are sure of that, many people would rather just replace the drive rather than hope the damage is limited and doesn't escalate. Thanks, Andy -- https://bitfolk.com/ -- No-nonsense VPS hosting

