From what I understand, there are two fundamental ways sectors are marked bad:
- OS performs IO read/write instruction. The sector is replaced with a spare and marked bad.
- Disk's low-level instructions perform garbage collection (i.e. replace and mark bad sectors with spare sectors), silent from the OS and the user.
I have a few questions by which I'm still perplexed.
When a tool like Windows Chkdsk performs repairs, is it marking the sector bad at the file-system level (high) or sector level (low)?
If the OS reports a bad sector to the user (i.e. again, Chkdsk), does that mean the hard drive has run out of spare sectors?
When the disk replaces bad sectors with spare ones, does it always move/copy the data to the spare? Or, at times, data cannot be moved/copied from the bad sector to the spare? If it's the latter, what data is stored in the bad sector and spare sector?
I understand it's possible to do a low-level format of the disk by zeroing out all the sectors. Is this done to clear logical bad sectors (i.e. failed ECC/CRC check) and mark physical bad sectors?
Finally, let's say Windows shuts down due to a power failure and the disk was still writing to a sector. The machine boots and Chkdsk starts up. If there are spare sectors, whether the error is purely logical (i.e. ECC failure) or physical, will it report to the user that there are no errors because the bad sector has been replaced with a spare?
Thank you very much.