I recently bought a 4TB hard disk and I want to do a read-write badblocks
test on this before I start using it. Since running badblocks
with -w
option would take ages for 4TB, I've thought to first write a pattern on the disk and then use the -t
option to read that pattern through badblocks
, completing it in hours rather than in days.
The problem is that I couldn't understand how the -t
option of badblocks
works and I got no search results when searching the web for an example of using badblocks
with -t
option. From man page, test pattern is a numeric value between 0 and ULONG_MAX-1 (I'm making a wild guess that ULONG_MAX is 2^32
), but I'm not sure how to provide the pattern (decimal? hexadecimal? binary? ASCII string with length < 2^(32/8)
?). And is the pattern size related to block size?
The other part of the problem is to write a script to fill the hard disk with the pattern. I can write a Ruby script to do that, but a one liner bash command piped through pv
would be nice!