A bad sector in computing is a disk sector on a disk storage unit that is unreadable. Upon taking damage, all information stored on that sector is lost. When a bad sector is found and marked, the operating system like Windows or Linux will skip it in the future. Bad sectors are a threat to information security in the sense of data remanence.
On the other hand, sectors broken physically cannot be restored: writing would fail, forcing a remap. A new drive may start with some innocuous bad sectors due to manufacturing flaws. Larger patches occur throughout use, due to head crash, wear-and-tear, physical shock, or dust intrusion.
On solid-state drives, flash wear or flash controller error may also cause bad sectors.
With the advent of SMART-enabled disk controllers (see below), the burden of avoiding bad sectors more commonly falls to the disk. Some newer file systems such as Btrfs and ZFS do not have a bad-block avoidance feature at all. Software tools that look for bad blocks still have a use case: by issuing writes at detected bad sectors, one can expedite the remapping process, avoiding further attempts at reading the bad sector.. "--make-bad-sector Deliberately create a bad sector (aka. "media error") on the disk. ... Note also that the --repair-sector option can be used to restore (any) bad sectors when they are no longer needed, including sectors that were genuinely bad (the drive will likely remap those to a fresh area on the media). --write-sector: This can be used to force a drive to repair a bad sector (media error)."
When a sector is found to be unwritable (or not holding onto the written data when read immediately after a write), the firmware typically remaps the logical sector to a different physical sector no matter whether it was marked pending. Conversely, if a pending sector is successfully written to, it is removed from the pending list.
In both cases, the operations are transparent to the operating system, which only needs to issue sector-read and sector-write commands. The retries due to an unreadable sector may cause excessive delay before a definite success or failure.
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). Utilities 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. Monitoring Hard Disks with SMART.Linux Journal, 2004. Because reads and writes from G-list sectors are automatically redirected (remapped) to spare sectors, it slightly slows down drive access even if data in drive is defragmented. Once the G-list is filled up, the storage unit becomes incapable of further remap and will show write errors to the operating system.
For example, with a sector that fails the first read attempt but succeeds on subsequent ones, the following choices are reasonable: ignore, write what was successfully read back (refresh), or attempt to remap (because the sector has proven to be bad at retaining data). The ATA command set provides ways to do the first two but not the third, leaving the possibility of further rot on this sector. The situation is similar with fully unreadable sectors, just more severe as the sector has proven capable of total data loss. The old filesystem mechanisms for avoiding bad sectors can be used in this case to avoid writing new data to such dubious sectors.
The SCSI / ATA Translation (SAT) standard defines a read-write-verify sequence for translating the command to ATA.Information technology - SCSI / ATA Translation - 6 (SAT-6) Draft Revision 2 SAT6r02.pdf
The newer alternative to a raw in ATA is , which flags sector as bad immediately and prohibits further retries. The corresponding command in SCSI is with a (write uncorrectable) option bit set. This can be accessed through hdparm or .
The counterpart to is the equally obsolete . It can be used to read the raw sector contents including the ECC data. It is accessible through for SCSI. No known program uses the ATA version of this command.
Handling
Operating system
Disk controller
Command set comparison
Manipulation methods
Frequency
See also
External links
|
|