Smart tools - S.M.A.R.T.

Smart is a system for surveilling the health state of hard drives, for more info please visit wikipedia. In short it's a great tool that one should use.

What you need

  • a disk drive (if the disk is within a computer it's even better)
  • smartmontools - the package with the "smart" tools
  • apt-get install smartmontools

S.M.A.R.T. support

First you need to see if S.M.A.R.T. is supported by your system.. . (for all the below examples we shall assume we want to test hda or sda (IDE/SATA), adjust to your needs)

If you have an IDE drive :

smartctl -i /dev/hda

for SATA do :

smartctl -i -d ata /dev/sda

The output should resemble :

[root@weetabix][~-11:11] smartctl -i -d ata /dev/sda smartctl version 5.36 [i686-pc-linux-gnu] Copyright (C) 2002-6 Bruce Allen Home page is http://smartmontools.sourceforge.net/ === START OF INFORMATION SECTION === Device Model: ST3160812AS Serial Number: 5LS49ZE1 Firmware Version: 3.AAE User Capacity: 160 041 885 696 bytes Device is: Not in smartctl database [for details use: -P showall] ATA Version is: 7 ATA Standard is: Exact ATA specification draft version not indicated Local Time is: Tue Apr 15 11:11:47 2008 CEST SMART support is: Available - device has SMART capability. SMART support is: Enabled

If you see SMART support is: Disabled instead of SMART support is: Enabled then you just need to activate S.M.A.R.T. and this is only possible if you see SMART support is: Available - device has SMART capability..To activate S.M.A.R.T. :

smartctl -s on /dev/hda

if you have a SATA drive :

smartctl -s on -d ata /dev/sda

Testing the drive

The option -H will output the health state of the drive, this is based on the "offline" tests that you must manually execute and other tests that the drive wil do on its own when SMART is activated. To activate SMART use the switch -s like this :

smartctl -H /dev/hda

for SATA

smartctl -H -d ata /dev/sda

The result should be :

SMART overall-health self-assessment test result: PASSED

If it isn't then you should backup all important data now and worry a little bit, the disk could live its last moments.

A quick test

This will execute a quick electronic, mechanical and read performance test.

smartctl -t short /dev/hda

SATA

smartctl -t short -d ata /dev/sda

A message should show how much time the test will take and even the time it should end, generally it's around 2 minutes. The test will run in the background, you can get the results by (wait for the test to end for better results :] ) typing :

smartctl -l selftest /dev/hda

and for SATA, now you probably figured out that you just need to add '-d ata' every time :]

smartctl -l selftest -d ata /dev/sda

You could see something like this :

=== START OF READ SMART DATA SECTION === SMART Self-test log structure revision number 1 Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error # 1 Short offline Completed without error 00% 7022 -

if your not as lucky it could be more like :

=== START OF READ SMART DATA SECTION === SMART Self-test log structure revision number 1 Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error # 1 Short offline Completed: read failure 60% 18222 44603135

A more complete test

This test is like the short version except that it takes so longer so it's more... thourough..

smartctl -t long /dev/sda

just in case :p - SATA

smartctl -d ata -t long /dev/sda

On a 40GB drive (and IDE and a SATA) this test took 17 minutes for me. To see the results, same story as the short test.. you might see the results of previous tests too...

For a good healthy disque you might see :

=== START OF READ SMART DATA SECTION === SMART Self-test log structure revision number 1 Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error # 1 Extended offline Completed without error 00% 7023 - # 2 Short offline Completed without error 00% 7022 -

If your hard drive is getting close to the end of retirement you might see something like :

=== START OF READ SMART DATA SECTION === SMART Self-test log structure revision number 1 Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error # 1 Extended offline Completed: read failure 20% 18223 45651711 # 2 Short offline Completed: read failure 60% 18222 44603135 # 3 Extended offline Completed without error 00% 0 -

Want to see the error logs ?

I wish disk errors would never occur... but if you need to see the error logs (or if you just like seeing the message "No Errors Logged") than use the option "-l error".

smartctl -l error /dev/hda

SATA :]

smartctl -l error /dev/sda

And that's it for us, if you want to read more about it go read an article written by the author.

Leave a comment
You may use the following HTML tags: <p> <a> <strong> <b> <em> <i> <cite> <blockquote> <code> <pre>

Your comments WILL NOT be submitted to any third party (not even for anti spam verification).