When I run into a a hard drive that may be failing, I scan it using ViVARD, which reliably lets me know if the drive needs replacing.

How do these sorts of tools work? How can they tell a bad sector from a good sector?

  • 4
    Software like that reads every sector on the drive. If it is unreadable it may try some tricks to get it to read, if enough data in a sector is unreadable and unrecoverable then it is marked as bad.
    – Moab
    Oct 2, 2015 at 16:58
  • 2
    Firmware does not tell them. How a HDD works from that point has changed drastically in 25 years, and even the last 5 years.
    – qasdfdsaq
    Oct 2, 2015 at 17:27
  • superuser.com/questions/1218312/…
    – SDsolar
    Jun 12, 2017 at 5:42

4 Answers 4


Modern hard drives implement a system in firmware called SMART. This system collects statistics on the drive performance, and automatically avoids data loss by moving data away from bad sectors.

Diagnostic tools query the hard drive's SMART software to build a health check report.

Bad sectors are detected upon accessing the hard disk and are avoided and relocated by the SMART system.

  • 1
    modern do, but this was perfectly possible and commonplace even without them.
    – eis
    Oct 3, 2015 at 6:16

I do not know ViVARD so this is a general answer.


SMART is a part of most modern drives. It registers when the hard drive sees a bad sector, when the seek or spin up time is more than normal. These are all indicators that the hard drive is failing.

The way the hard drive salvages a failing sector is due to error correcting codes (usually this is Reed-Solomon) that can rescue if a few bits are wrong. If many bits are wrong the hard drive tries salvaging by reading the sector over and over again. When it finally get it right, it saves it to one of the spare sectors.

Reading sector

The hard drive reallocates sectors with read errors to a set of spare sectors that are reserved for this. The OS usually does not see this, but sees the whole drive as having no errors. Only when there are no more sectors to reallocate to (or the sector cannot be salvaged) will the OS see the broken sectors.

But it is possible to bypass the error correcting (I believe it is different for each model - maybe ViVARD does this?). This way you can read the actual data on the drive. By reading this you will be able to see which sectors have errors - even if the OS sees no errors.


Use S.M.A.R.T. The hard drive manufacturers should have a software download for it on their web site. When you use SMART - run a full scan.


If I were to write such a diagnostic program, my program would go through the drive sector-by-sector with the following procedure:

  1. Move data currently in the sector to a new (currently empty) location for preservation (and update any file tables that used this sector).
  2. Write known new data to the sector.
  3. Read the written data from the sector.
  4. Compare was written bit-for-bit with what was read.
  5. (Assuming step 4 passed) Move original data back to original location (to avoid fragmenting files).

Of course, that's just the naive version. I suspect there are algorithms used today to make this general process more efficient. Additionally, there are different patterns that tools use for the "known new data", and different levels of repetition.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .