If I have "badblocks" write its output to a file, and that file is empty, does that mean that no bad blocks were found?

8

2

I recently ran badblocks on a large server hard drive to check for possible issues (SMART reported that everything was fine, but I needed to be sure).

The command I used was: badblocks -c 1024 -b 4096 -w -s -o /path/to/myfile.txt /dev/mydrive I used destructive-write mode because the downtime of the drive was important, and we determined that it would be faster to nuke the drive during the bad-blocks check and then re-add it to the RAID it had been a part of later than wait on the non-destructive test.

When it completed, myfile.txt had been created but was empty.

This seems like a very silly question, but: the file being empty indicates that no bad blocks were found, correct? The manpage for badblocks seems to indicate this, but I want to be as sure as I can be.

Zac B

Posted 2013-11-29T16:52:28.907

Reputation: 2 653

Answers

4

Yes, if the file is empty, badblocks didn't find any broken blocks. Did you also run the extended SMART selftest?

Carlo Cannas

Posted 2013-11-29T16:52:28.907

Reputation: 155

Yes, I did. I used badblocks because I wanted to be double-sure, as offlining the system or breaking the RAID to check the drive makes the users grumpy. Thanks! – Zac B – 2013-11-30T21:31:46.393

0

Methods don't matter. Everything you have to do is to scan the entire surface of the disk. You can do it via smart (Extended offline test) or even by using dd. You have to read every single sector on the disk because there is no other way to check if all of the sectors work. So, if you did the full scan and there's no sector reported, then everything is just fine.

I'm not sure but I think that the "destructive-write mode" is for reallocation of a bad block because this can be done only if you write a damaged sector.

Mikhail Morfikov

Posted 2013-11-29T16:52:28.907

Reputation: 781