I can't find anything about what badblocks actually considers a bad block. I've read the man page and looked at a bunch of questions on here, but I can't find specifics. Also, how good is badblocks? Should I trust it's results? My company historically used Victoria on Hirens Boot CD to test hard disks, but that isn't always a good option on newer computers.


badblocks reads, and writes, and compares (not necessarily in that order).

Subsequently badblocks -v will output messages like:

Pass completed, n bad blocks found (x/y/z errors)

Which means it found n bad blocks, consisting of x read errors, y write errors and z corruption errors. It considers read errors and write errors as they occured while reading and writing (as reported by the kernel). These errors can also be caused due to cable / controller / driver problems.

A corruption error is where data was compared and found to be different than expected (i.e. the data it read deviated from previously known/written data). In particular badblocks might write various data patterns (specified by one or more -t pattern options) and check if each pattern was written correctly.

It's possible to get false positives for corruption errors, if you have another program doing their own writes while badblocks is running. If another program writes, the disk is behaving correctly, but badblocks won't know about that, it just sees what it considers the wrong data.

Which is also why you should never run badblocks on a drive that is in use, on a drive that already has a filesystem that could be mounted automatically without you knowing, or on drives you already suspect are bad but you still wish to recover your data.

In terms of data recovery, you should always go with ddrescue instead of badblocks. ddrescue does very much the same thing badblocks (read mode) does, it reads the entire drive and logs down the sectors it couldn't read; but at the same time it produces a useful copy, whereas badblocks just discards the data entirely.

Is it trustworthy?

badblocks is a tool like any other, it does exactly what it says in the manpage - search a device for bad blocks. It may or may not be the right tool for whatever it is you want to do.

In the wrong hands, it might be the cause of data corruption. The so called non-destructive mode is a false friend and does not imply safety for your data at all.

badblocks (write mode) is primarily useful to put a new, empty drive through the wringer before trusting it with data.

For a read only test, it's usually better to go with SMART selftests (smartctl -t long or smartctl -t select). Safer than badblocks and friendly to other I/O.

  • 3
    By trustworthy, I mean are the results trustworthy. As in, if it says there are 0 bad blocks, are there really likely to be 0 bad blocks? I'm more concerned about false negatives for corruption errors Nov 14 '17 at 23:54
  • 2
    OK, that's a different angle and difficult to answer really. On the face of things, there really are 0 bad blocks. But hard drives like to sweep their uncorrectable errors under the rug after all, by reallocating sectors. badblocks can't see those errors. So it's also possible for a faulty hard drive to come out with 0 errors. It worked for badblocks (it reallocated as badblocks was writing test patterns) but the drive is already falling apart behind the scenes. Nov 15 '17 at 0:43
  • What about the inverse - how likely are bad sectors logged in with badblocks -o to be genuine? I have just one on my disk at the very last block of the disk - is this more likely to be genuine or a false positive? Nov 28 '19 at 22:46

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.