A method and apparatus for detecting flaws requiring sparing of portions of storage
media included as part of a hard disk drive are provided. A window of a selected
portion of the storage medium is formed, and the density of defects detected within
that window is calculated. If the density of defects exceeds a threshold amount,
a signal is passed to the controller. The portion of the storage media containing
the defects that caused the generation of the flag may then be spared. The present
invention allows the potential for detected defects to significantly affect the
ability of the storage medium to be assessed. Furthermore, the present invention
does not require that the location of each defect be stored in memory. Accordingly,
the present invention is economical to implement, and allows defects to be assessed
in substantially real time and with improved accuracy.