Posted by: Mangesh_Linux_Administrator | November 27, 2010

smartctl (How do I test if my Linux server SCSI / SATA harddisk going bad)

How do I test if my Linux server SCSI / SATA hard disk going bad?

One of our regular sends us a question:

How can I test if my hard disk is going bad? I see few errors in /var/log/messages file.

I/O errors in /var/log/messages indicates that something is wrong with the hard disk and it may be failing.

Next thing is check hard disk for error using smartctl command, which is control and monitor utility for SMART disks.

smartctl controls the Self-Monitoring, Analysis and Reporting Technology (SMART) system built into many ATA-3 and later ATA, IDE and SCSI-3 hard drives. The purpose of SMART is to monitor the reliability of the hard drive and predict drive failures, and to carry out different types of drive self-tests.

smartctl is a command line utility designed to perform SMART tasks such as printing the SMART self-test and error logs, enabling and disabling SMART automatic testing, and initiating device self-tests.

Make sure S.M.A.R.T. support is enabled in the BIOS.

Next run following command to see if your hard disks support S.M.A.R.T technology:
# smartctl -i /dev/sdb

Now enable SMART:
# smartctl -s on -d ata /dev/sdb

smartctl version 5.33 [x86_64-redhat-linux-gnu] Copyright (C) 2002-4 Bruce Allen
Home page is

SMART Enabled.

Now run overall-health self-assessment test:
# smartctl -d ata -H /dev/sdb

smartctl version 5.33 [x86_64-redhat-linux-gnu] Copyright (C) 2002-4 Bruce Allen
Home page is

SMART overall-health self-assessment test result: PASSED

You can read more data from hard disk by typing following command:
# smartctl -d ata -a /dev/sdb

A note about RAID controller

To look at ATA disks behind 3ware SCSI RAID controllers, use syntax such as:
# smartctl -a -d 3ware,2 /dev/sda
# smartctl -a -d 3ware,0 /dev/twe0
Extended self-test of drive

You need to begin an extended self-test of drive /dev/hdc. You can issue this command on a running system. The results can be seen in the self-test log visible with the ´-l selftest´ option after it has completed.
# smartctl -d ata -t long /dev/sdb

If any one of these test reports error, replace hard disk and restore data from backup.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


%d bloggers like this: