I am using badblocks to do a destructive erase of any data on the disk; using the following command:
badblocks -wsp 0 /dev/sdb1
I passed the option -p 0
in the hopes that this would result in only a single pass, but I am getting multiple passes:
Testing with pattern 0xaa: done
Reading and comparing: done
Testing with pattern 0x55: done
Reading and comparing: done
Testing with pattern 0xff: done
Reading and comparing: 19.01% done, 7:43:47 elapsed. (0/0/0 errors)
From reading the manpage, I can see that the -w
option itself includes four passes:
-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. This option may not be combined with the -n option, as they are mutually exclusive.
This is excessive for my needs. Is there any way to achieve a single destructive pass?
1
. If you only did test with the0xff
-pattern, you would not be able to find this error. Sincebadblocks
is not designed to erase the data, but to find bad blocks, multiple passes is not considered to be excessive.0xff
and immediately checks if there is0xff
written by reading the location from disk. So the stuck 0 is ruled out. Then, it does the same with0x00
to rule out the stuck 1 error. so 1 pass with each pattern is sufficient. The other ones (alternating pattern of0
and1
) are against bits that stick together (if I set bit N to1
, bit N+1 also goes to1
as a result of the error)