1

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.

migrated from serverfault.com Feb 20 '14 at 22:49

This question came from our site for system and network administrators.

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

  • Thank you for a detailed response. I sincerely appreciate it! Just some clarifications/amplifications: 1. Chkdsk does not trigger the disk's firmware to mark bad sectors, it's purely high-level? Ex: 0 bad sectors on drive. Chkdsk runs and repairs filesystem. Your low level tool would still see 0 bad sectors?...3. It's fascinating how the OS can't read a bad sector but the disk's firmware sometimes can. Is it b/c it can skip the ECC/CRC check? Again, I really can't thank you enough for your time. – user301234 Feb 21 '14 at 15:40
  • Yes, chkdsk does not always trigger the firmware to mark a sector bad. chkdsk reports "####kb in bad sectors", but only it is run. You could have 100 bad sectors near the end of the hard drive and never know about them unless you do a chkdsk /R or chkdsk /B. If you do have 100 bad sectors you need to replace the drive. It does not skip ECC is reads the sector several different ways/times and hopes that the ECC data will be able to fix the data from one of the reads. A low level tool,depending on how low it is, will see ALL of the bad sectors and how many have been remapped. – cybernard Feb 22 '14 at 6:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.