This week's book giveaway is in the Reactive Progamming forum. We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line! See this thread for details.
About the only way to reliably fix bad sectors on a hard drive is to run the drive manufacturer's sector verification utility which will examine each sector and relocate bad sectors (thus removing them from the available sector pool). Of run the manufacturer's reformatting utility which reformats the disk (back up first - the disk will contain no data after the reformatting). But even those two steps didn't fix one of my drives - I noticed that both utilities had problems when they were about 98% done with the sector scan. So I resized my partition to avoid the last 2% of the disk and have had no problems since then.
For a laptop, my recommendation is to get another hard drive and use a drive imaging tool to move you existing data to the new drive. Then place the old drive into a USB enclosure and run the tools on that at your leisure. If the old drive is still usable you'll have a convenient backup drive.
It isn't necessarily possible to fix a bad sector -- for example if there's a scratch on the surface of the disk, that can't be fixed. Especially by software. However the formatting process is supposed to recognize bad sectors and exclude them from the file system. So essentially as far as the operating system is concerned, once that's done they don't exist.
Punit Jain wrote:Does low level formatting fix bad sectors?
Well the answer would be no. Low level format, also known as "zero fill drive" writes a 0 to each and every memory location down to byte level.
This will only safely erase all your data, without being able to recover it, ever.
For the bad sector part, the common solution is try to recover data from that sector using specialized software, try to fix the sector, if not fixable, mark it bad.
My experience is that when bad sectors appear on modern hard disks, it's time for a new one. The disk reserves some space which is used to replace bad sectors that appeared somewhere on the drive, without even notifying the OS (the HDD controller handles that transparently). When the OS detects a bad sector, it usually means the reserved capacity for bad sectors has been already exhausted and the HDD controller cannot conceal the failure. The drive is in all probability already in a bad shape.
I personally haven't seen bad sector for years. The last time one appeared was due to an on-board RAID controller malfunction (as was later determined).