Linux: Check Hard Disk for error

A few days ago I was investigating about some software failure occurred on a server running CentOs, and I suspected a corrupted hard drive (the server is equipped with a SSD disk that does not support S.M.A.R.T.):  I wrote these few notes to explain the procedures followed.

To start I have forced the fsck on the next reboot. In order to force your system to run fsck on your file systems during the next reboot you need to create a file called forcefsck in the root folder.

# touch /forcefsck

Now you have to force restart.

init 6

At the reboot the system will run fsck and will check the file system integrity (and after completing this it will also remove the /forcefsck file from the system). You can then check the scan result on the console or in the log.

For a more deeply test I used Knoppix: boot with this CD and in a console type the following.

su root
badblocks -snv /dev/sda1

In this mode the system will check the badbloks in non-destructive mode: the result will be shown directly on the screen.