Windows – Bad sectors vs spare/reserve sectors and how the OS and disk interpret them

bad-blockschkdskhard drivessdwindows

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.

  1. When a tool like Windows Chkdsk performs repairs, is it marking the sector bad at the file-system level (high) or sector level (low)?

  2. 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?

  3. 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?

  4. 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?

  5. 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.

Best Answer

    1. Check disk adds an entry to the bad cluster table that is hidden and buried in c:\system volume information folder. Chkdsk hides bad sectors. It tells the file system not to use that sector, but does not fix anything.

    2. Sometimes yes, sometimes no. It could mean the hard drives internal detection method has not found it yet.

    3. The disk attempts to copy as much data as it can to the new sector. If it can't be read the new sector is blank or has random data in it.

    4. That is one reason it is done, but it can't always clear all bad sectors. Another valid reason, is privacy. If you sell your computer or hard drive you don't want the next person looking at your data. A 3rd valid reason is to get rid of a really tough virus/rootkit, or etc.

    5. Generally, in the vast majority of cases a power failure does not cause bad sectors. If you have a really really old drive that is already in poor health it might cause a bad sector. You can corrupt the contents of the sector, but the sector itself will remain fully functional. It is usually possible to simple copy over the damaged file with a good copy and all is well.

    If you think of a sector as say a whiteboard(the replacement of the chalkboard). The space is evenly divide into sectors when the power goes off the computer stops writing what is working on and forgets the rest. Therefore, the sector is incomplete, but not physically damaged. Now going back to the whiteboard, image someone slams a brick into it, now there is physically unusable space and that is a bad sector.

  • Related Question