Upon reading the manpage further, I've solved the problem. -w
does indeed do a single pass, as implied from the description of the -p
option:
Default is 0, meaning badblocks will exit after the first pass.
A pass consists of four test patterns:
-w Use write-mode test. With this option, badblocks scans for bad blocks by writing some patterns (0xaa, 0x55, 0xff, 0x00) on every block of the device, reading every block and comparing the contents.
The pattern can be overriden using the -t
option:
-t test_pattern Specify a test pattern to be read (and written) to disk blocks. The test_pattern may either be a numeric value between 0 and ULONG_MAX-1 inclusive, or the word "random", which specifies that the block should be filled with a random bit pattern. For read/write (-w) and non-destructive (-n) modes, one or more test patterns may be specified by specifying the -t option for each test pattern desired. For read-only mode only a single pattern may be specified and it may not be "random". Read-only testing with a pattern assumes that the specified pattern has previously been written to the disk - if not, large numbers of blocks will fail verification. If multiple patterns are specified then all blocks will be tested with one pattern before proceeding to the next pattern.
Example command:
badblocks -wsvt 0 /dev/sdz
Example and output:
# badblocks -wsvt 0 /dev/sdz
Checking for bad blocks in read-write mode
From block 0 to 488386583
Testing with pattern 0x00: done
Reading and comparing: done
Pass completed, 0 bad blocks found. (0/0/0 errors)