check a new HDD for bad blocks
You buy/get a new HDD and you want to make sure that it has no bad sectors. How to check that?
I found a solution here. In short:
sudo badblocks -wvs /dev/sdx
/dev/sdx is the drive. WARNING! This is a destructive check, i.e. all data on the drive will be lost!
“The -w option tells badblocks to write a known pattern, then read back the data to make sure it matches the pattern. It does this 4 times, using the patterns 0xaa, 0x55, 0xff, and 0x00 (alternating 0’s and 1’s, then all 1’s, then all 0’s). Note that this will overwrite all data on the drive and wipe out all the partitions, as well.” (source)