I've been scouring the internet looking for a source on this, but have been unable to find any official documentation about Badblocks - the program that's a part of the standard e2fsprogs.
I'm using Badblocks to validate new drives that I buy, and the output always comes in:
- Read errors
- Write errors
- Compare errors
Badblocks writes data to sectors, and then goes back and checks it to make sure that it was written properly, a test of everything involved. Compare errors pop up when the data written does not match the data read back.
My question is - what exactly is a "read error", and what exactly is a "write error"? How does Badblocks determine these failures? What thresholds are acceptable for a new drive vs. a used drive?
The kernel block layer can return write or read errors from the drive if the drive returns an error during the operation. Corruption error is when drive did not return any errors but written and read data do not match.
The latter error only occurs with write destructive or non-destructive badblocks test, otherwise there would be nothing to compare against.
You should not keep any drives with any bad blocks unless for testing and scratch data or at least data that you can easily otherwise recover. Some manufacturers would also replace a drive with 0 bad blocks but some reallocated sectors shown by SMART. See
smartctl -a <dev>
.see also https://unix.stackexchange.com/a/65351/14907
I would be concerned if badblocks would output anything else outside of:
Pass completed, 0 bad blocks found (0/0/0 errors)
for brand new drives.
For used drives, that is another story. You might be able to live with a few bad blocks, but if the drive is in warranty, you should have it replaced. Note that most manufacturers require you to perform a test with their tools and give them the "failure code".
If you cannot get the drive to fail their test, you might have to battle with them to have it replaced. You could start by getting the S.M.A.R.T summary and send it to them