Checking a new disk for bad blocks on Linux, does read-only make sense?

0

When I issue the following command

sudo badblocks -vs -b 4096 -o badsectors2.txt /dev/sdc1

I get as a response

Checking blocks 0 to 1152784944
Checking for bad blocks (read-only test):  72.37% done, 7:32:49 elapsed. (0/0/0 errors)

Now my question is, if this is a new, empty disc, does this test make sense?

The write-read test, which writes (destructively) patterns on the disc in order to check if they get read back correctly, surely does make sense.

But a new disc has no info on it, so no data with checksums which can get read and checked. Am I right?

Also, this is a 5TB disc, which I'm checking the first partition of, which is about 4.2TB in size. I can't remember which blocksize got set during fdisk, when I partitioned the disc (I used the default), but when I call the badblocks command without -b 4096, then I get an error because of int32. So I increased the block size for the test, as I found in an answer on this site.

Is this a problem if the number set in -b doesn't match the one set by fdisk during partitioning (or maybe it was in mkfs.ext4)?

I didn't use a write-read test because I already copied a database over to that disc, which took almost 3 days for 400GB (dump+restore); I didn't want to repeat that, although I could.

Daniel F

Posted 2018-10-25T19:18:29.977

Reputation: 751

Answers

1

I don't think this test is meaningful for a new and modern disk. badblocks has very limited usefulness nowadays with disks having very large sector-reallocation areas.

The badblocks utility is extremely simple-minded and does not have any low-level knowledge of the disk. All it does is just doing normal I/O to the device file using fairly plain read/write calls.

If the disk decides to remap sectors during a badblocks run, badblocks has no way to detect this, so it would return success when you could have any number of bad sectors found.

In any case, having the disk remap the sectors and have the bad sectors hidden permanently, is a much a better solution than adding the bad sectors to the filesystem's bad blocks list.

My advice is not to lose your time with this ancient utility. Use more modern utilities, or trust the manufacturer. If you have written 400 GB without error, the disk is evidently not dead-on-arrival.

harrymc

Posted 2018-10-25T19:18:29.977

Reputation: 306 093

Thanks, I'll accept it after a couple of days, in case other answers roll in. Would you mind naming me one or two of those "modern utilities"? I do have a copy of Spinrite, maybe I should use that once on the drive, or would even that be meaningless? – Daniel F – 2018-10-25T20:10:32.060

1

Bad blocks is non-deztructive mode is not as thorough as destructive mode, however it can detect issues reading sectors regardless of them not bring written prior. If the disk had alignment issue or other similar problems it could still be useful.

The block size may impact the speed and granularity of errors checked - but should not cause parts to be skipped.

davidgo

Posted 2018-10-25T19:18:29.977

Reputation: 49 152