Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

The man pages for badblocks do not seem to mention what the three numbers in the output mean in particular:

Pass completed, 7 bad blocks found (7/0/0 errors)
Pass completed, 120 bad blocks found (0/0/120 errors)

I'm guessing it's "Errors while reading/writing/comparing". Can someone enlighten me?

share|improve this question

2 Answers 2

up vote 6 down vote accepted

Your guess is correct.

The source code looks like this:

if (v_flag)
    fprintf(stderr,
            _("Pass completed, %u bad blocks found. (%d/%d/%d errors)\n"),
            bb_count, num_read_errors, num_write_errors, num_corruption_errors);

So its read/write/corruption errors. And corruption means comparison with previously written data:

if (t_flag) {
    /* test the comparison between all the
       blocks successfully read  */
    int i;
    for (i = 0; i < got; ++i)
        if (memcmp (blkbuf+i*block_size,
            blkbuf+blocks_at_once*block_size,
            block_size))
            bb_count += bb_output(currently_testing + i, CORRUPTION_ERROR);
}
share|improve this answer
    
Perfect. Looking it up in the source the one thing that should have occurred to me, but somehow it didn't. Thanks. :) –  Tomalak Feb 19 '13 at 16:52
    
Of course that's also the reason why there are no kernel error messages in the (0/0/120 errors) case. –  Tomalak Feb 19 '13 at 16:59
    
A possible cause for corruption errors is that something else wrote to the disk while badblocks was running, in which case it wouldn't be an error at all (other than user error). –  frostschutz Feb 20 '13 at 22:31
    
In this case it's a suspect disk that I'm using exclusively with badblocks. No other process writes to it. Is there a way to visualize the output file with the bad sector list, short of manually calculating their position? –  Tomalak Feb 21 '13 at 8:18

Wrong. If badblocks says anything that isn't "no errors found", it means:

  • Turn off the machine immediately
  • Get a replacement disk
  • Pray to $GOD_OF_BACKUPS important data is safe
  • Do whatever is needed to set up the new disk, and copy the data from the old one

You may optionally keep the disk around for entertainment, or as a paperweight.

(Modern disks have a set of extra cylinders for remapping bad blocks, as there is no way to manufacture disks without them, and users screamed bloody hell when they saw the bad block list. If bad blocks do show up, it means that that space is used up. As the common failure modes of rotating disks give exponentially increasing number of bad blocks, seeing some means that the disk typically has a few hours left.)

share|improve this answer
1  
That wasn't even the question. –  Tomalak Feb 20 '13 at 7:37
    
Never run badblocks on a disk that has important data on it. If the disk has an error, badblocks may cause extra damage even in nondestructive write mode, if it can't write the original data back due to the error. –  frostschutz Feb 20 '13 at 22:29
    
@frostschutz, The -n test is supposed to be read-only? –  vonbrand Feb 20 '13 at 22:32
    
No, -n is nondestructive write. So it writes, but restores the original data after testing. Which may fail due to errors. For readonly badblocks, I believe you use no option at all. –  frostschutz Feb 20 '13 at 22:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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