Hard Drives Health Checks

When one builds a NAS, specifically on a tight budget, it might well happen that “second hand” hard drives are used to fill the hard disk bay…

One important thing to do before trusting those drives to safely store your precious data is to check their health. Here are a few command tools that can be used to performs such checks.

The following was collected from this blogspot article, as well as from this one on LinOxyde.

The badblocks command is part of the e2fsprogs package, if it is not yet installed on your system:

> sudo apt-get install e2fsprogs

badblocks will check a hard drive and log defective sectors to a file that can be used with other programs, like mkfs, so that they will be locked out of usage.

> sudo badblocks -v /dev/hda1 > hda1-bad-blocks

badblocks isn't particularly verbose, so if one wants to (more or less) monitor it's activity, iostat can help visualize disk activity:

> sudo apt-get install sysstat

To monitor activity per disk:

> sudo iostat -xd <update interval in seconds>

To monitor activity per partition:

> sudo iostat -pxd <update interval in seconds>