Sunday, August 04, 2013

Checking disk drive under Linux

There is a time when old hard drives start to die out. Here are some tools to help diagnose the issues:

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

Does a read-only check for bad blocks and outputs a file (bad-blocks in this case) with the list of the bad blocks found. The parameter can be a whole disk (as above) or any of the partitions. In case of a partition, use /dev/sda5, instead /dev/sda, for example.

sudo fsck -t ext4 -l bad-blocks /dev/sda

Fsck will read the contents of bad-blocks file and check the reported sectors. After analysis they will be marked as bad.

'Disks' is a GUI utility that displays the drives attached, including the partitions.


No comments: