# badblocks check



## ccc (Aug 27, 2013)

*H*i*,*

How to check a second hard disk for bad blocks? BTW, this second disk can be formatted.


----------



## wblock@ (Aug 27, 2013)

Install sysutils/smartmontools.

Check for any existing grown bad blocks:
`# smartctl -a /dev/ada1 | less -Sip reallocated_sector`
Scroll all the way to the right, if the last number on that line is higher than zero, consider the drive untrustworthy.

Try a short test next:
`# smartctl -t short /dev/ada1`

If that succeeds, try a long test:
`# smartctl -t long /dev/ada1`

Monitor the results with `smartctl -a /dev/ada1 | less`.


----------



## Nukama (Aug 29, 2013)

Try badblocks(), which is installed by sysutils/e2fsprogs.

`# badblocks -v -b 4096 -c 98304 -p 1 -w -s /dev/DEVICENAME`


----------



## wblock@ (Aug 30, 2013)

On modern hard drives, high-level bad block detection is not reliable.  The drives have error correction at a lower level that will hide errors from programs like badblocks.  smartctl(8) can be used to see the actual bad blocks after the long test will check the entire drive.


----------



## Nukama (Aug 31, 2013)

I'm using badblocks to do a really long test (with option -p). Letting it run for some days and compare the `smartctl` output between start and end. Reallocated sector count shouldn't increase, otherwise the drive is sent to RMA.


----------

