A bad sector is a sector on a computer's disk drive or flash memory that cannot be used due to permanent damage (or an OS inability to successfully access it), such as physical damage to the disk surface (or sometimes [clarify]) or failed flash memory transistors. It is usually detected by a disk utility software such as CHKDSK or SCANDISK on Microsoft systems, or badblocks on Unix-like systems. When found, these programs may mark the sectors unusable ( ) and the operating system skips them in the future.
If any of the files uses a sector which is marked as 'bad' by disk utility then the bad sector of the file is remapped to a free sector and any unreadable data is lost. To avoid file corruption data recovery methods should be performed first if bad sectors are found (before being marked) by OS at file system level.
When a sector is found to be bad or unstable by the firmware of a disk controller, the disk controller remaps the logical sector to a different physical sector. In the normal operation of a hard drive, the detection and remapping of bad sectors should take place in a manner transparent to the rest of the system and in advance before data is lost. It should be remembered, however, that the damaging of the physical body of the hard drive does not solely affect one area of the data stored. Very often physical damages can interfere with parts of many different files.
There are two types of remapping by disk hardware: P-LIST (Mapping during factory production tests) and G-LIST (Mapping during consumer usage by disk microcode).
There are a variety of utilities that can read the Self-Monitoring, Analysis, and Reporting Technology (SMART) information to tell how many sectors have been reallocated, and how many spare sectors the drive may still have. Because reads and writes from G-list sectors are automatically redirected (remapped) to spare sectors it slows down drive access even if data in drive is defragmented. If the G-list is filling up, it is time to replace the drive.
Typically, automatic remapping of sectors only happens when a sector is written to. The logic behind this is presumably that even if a sector cannot be read normally, it may still be readable with data recovery methods. However, if a drive knows that a sector is bad and the drive's controller receives a command to write over it, it will not reuse that sector and will instead remap it to one of its spare-sector regions. This may be the reason why hard disks continue to have sector errors (mostly disk controller timeouts) until all the bad sectors are remapped; typically this is accomplished by writing zeros to the entire drive. See the SMART attribute number 197 ("Current Pending Sector Count") for more information.
Software to fix the bad sectors: chkdsk and format (without quick option) are the tools accompanying Windows, which can be used to check for bad sectors and mark them bad. FBDISK can isolate the bad sectors and partition the remaining area to at most four partitions. It is run in DOS. Similar to FBDISK, PBD (Partition Bad Disk) also isolates bad sectors on HDD and creates healthy partitions. It is run in Windows and provides other partitioning functionalities.
- Sector slipping – a method of avoiding bad sectors
- Monitoring Hard Disks with SMART.Linux Journal, 2004.
- pcmag.com encyclopedia
- Stephens, Curtis E, ed. (December 11, 2006), Information technology - AT Attachment 8 - ATA/ATAPI Command Set (ATA8-ACS), working draft revision 3f, ANSI INCITS, pp. 198–213, 327–344