A bad sector is a sector on a computer’s disk drive that cannot be used due to permanent damage (or an OS inability to successfully access it), such as physical damage to the disk surface.
There are two ways to detect bad sectors in Linux: you can use the Disk Utility GUI, or if you are a command line geek like me, you can use the badblocks command to check your hard disk for bad sectors:
sudo badblocks -v /dev/sda2
Badblock will give you the number of bad sectors in our hard disk.
jeroen@laptop:~$ sudo badblocks -v /dev/sda2
Checking blocks 0 to 56477867
Checking for bad blocks (read-only test): 2543654 done, 4:41 elapsed
4326543 done, 9:26 elapsed
Pass completed, 2 bad blocks found.
You have two options when you see bad blocks. You can either look for a new hard disk, or mark these bad blocks as unusable hard disk sectors. This involves two steps:
First we have to write the location of the bad sectors into a flat file.
sudo badblocks /dev/sda > /home/jeroen/bad-blocks
After that, we need to feed the flat file into the FSCK command to mark these bad sectors as ‘unusable’ sectors.
sudo fsck -l bad-blocks /dev/sda
or one reader suggested it should read:
sudo mkfs -c bad-blocks /dev/sda
read more detailed information at http://www.howtogeek.com/howto/37659/