How to repair/isolate hard drive bad blocks

Red picture Red · Jan 26, 2014 · Viewed 43k times · Source

During the last month Ubuntu starts having some problems: it shuts down suddenly without any apparent reason.. I figured out that the problem is in the hard disk, if I run this command:

$ sudo badblocks -sv -b 512 /dev/sda

I get 24 bad blocks all in the Linux partition (I have Windows in another one and it does not have the same problem). The question is if there is a way (different from changing the disk) for avoiding this shutting down. Maybe isolating the bad blocks?

Answer

Matteo Italia picture Matteo Italia · Jan 26, 2014

Software/file system bad blocks marking is mostly a thing of the past; recent drives automatically relocate bad blocks in a transparent way.

If you start getting bad blocks "visible" to software it probably means that the hard drive is exhausting the reserve of free replacement blocks, so it's probably failing. You should check the SMART status of the disk to see if this is actually confirmed by the other SMART attributes, do a backup and get ready to replace your drive.