Wednesday, May 2, 2012

S.M.A.R.T ctl


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

You can check hard disk errors using smartctl command, which is control and monitor utility for SMART disks under Linux / UNIX like operating systems.

Some Device does not support SMART, you can check S.M.A.R.T has enabled or not using the following syntax.

root@tester [~]# smartctl -i /dev/sda
smartctl version 5.38 [x86_64-redhat-linux-gnu] Copyright (C) 2002-8 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

Device: IBM ServeRAID M5015 Version: 2.12
Serial number: 0060519a15558e94160054a603b00506
Device type: disk
Local Time is: Thu May  3 06:11:30 2012 CEST
Device does not support SMART

You need to enable the smart in the BIOS to monitor with it.

root@tester [~]# smartctl -s on /dev/sda
smartctl 5.39.1 2010-01-28 r3054 [x86_64-unknown-linux-gnu] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net

Smartctl open device: /dev/sda0 failed: No such device
root@tester [~]# smartctl -s on /dev/sda
smartctl 5.39.1 2010-01-28 r3054 [x86_64-unknown-linux-gnu] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF ENABLE/DISABLE COMMANDS SECTION ===
SMART Enabled.

 The command example below show another example of smartctl command that can be use to enable SMART monitoring tool on the disk device.

[root@tester ~]# smartctl --smart=on --offlineauto=on --saveauto=on /dev/sda


root@tester [~]# smartctl -t short /dev/sda
smartctl 5.39.1 2010-01-28 r3054 [x86_64-unknown-linux-gnu] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF OFFLINE IMMEDIATE AND SELF-TEST SECTION ===
Sending command: "Execute SMART Short self-test routine immediately in off-line mode".
Drive command "Execute SMART Short self-test routine immediately in off-line mode" successful.
Testing has begun.
Please wait 1 minutes for test to complete.
Test will complete after Thu May  3 11:37:28 2012

Use smartctl -X to abort test.

root@tester [~]# smartctl -t long /dev/sda
smartctl 5.39.1 2010-01-28 r3054 [x86_64-unknown-linux-gnu] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF OFFLINE IMMEDIATE AND SELF-TEST SECTION ===
Sending command: "Execute SMART Extended self-test routine immediately in off-line mode".
Drive command "Execute SMART Extended self-test routine immediately in off-line mode" successful.
Testing has begun.
Please wait 111 minutes for test to complete.
Test will complete after Thu May  3 13:28:08 2012

Use smartctl -X to abort test.

Check the health status of the hard drive using the following command.

root@tester [~]#  smartctl -H /dev/sda
smartctl 5.39.1 2010-01-28 r3054 [x86_64-unknown-linux-gnu] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
Please note the following marginal Attributes:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
190 Airflow_Temperature_Cel 0x0022   046   041   045    Old_age   Always   In_the_past 54 (4 241 54 53)

The following will provide even more information about failing hard disk:

root@tester [~]#  smartctl --attributes --log=selftest /dev/sda
smartctl 5.39.1 2010-01-28 r3054 [x86_64-unknown-linux-gnu] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF READ SMART DATA SECTION ===
SMART Attributes Data Structure revision number: 10
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_                                                                             FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x000f   120   100   006    Pre-fail  Always       -                                                                                    239201408
  3 Spin_Up_Time            0x0003   098   098   000    Pre-fail  Always       -                                                                                    0
  4 Start_Stop_Count        0x0032   100   100   020    Old_age   Always       -                                                                                    7
  5 Reallocated_Sector_Ct   0x0033   100   100   036    Pre-fail  Always       -                                                                                    0
  7 Seek_Error_Rate         0x000f   069   060   030    Pre-fail  Always       -                                                                                    7727839
  9 Power_On_Hours          0x0032   099   099   000    Old_age   Always       -                                                                                    1068
 10 Spin_Retry_Count        0x0013   100   100   097    Pre-fail  Always       -                                                                                    0
 12 Power_Cycle_Count       0x0032   100   100   020    Old_age   Always       -                                                                                    11
183 Runtime_Bad_Block       0x0032   100   100   000    Old_age   Always       -                                                                                    0
184 End-to-End_Error        0x0032   100   100   099    Old_age   Always       -                                                                                    0
187 Reported_Uncorrect      0x0032   100   100   000    Old_age   Always       -                                                                                    0
188 Command_Timeout         0x0032   100   100   000    Old_age   Always       -                                                                                    0
189 High_Fly_Writes         0x003a   100   100   000    Old_age   Always       -                                                                                    0
190 Airflow_Temperature_Cel 0x0022   046   041   045    Old_age   Always   In_th                                                                             e_past 54 (4 241 54 53)
191 G-Sense_Error_Rate      0x0032   100   100   000    Old_age   Always       -                                                                                    0
192 Power-Off_Retract_Count 0x0032   100   100   000    Old_age   Always       -                                                                                    7
193 Load_Cycle_Count        0x0032   094   094   000    Old_age   Always       -                                                                                    13964
194 Temperature_Celsius     0x0022   054   059   000    Old_age   Always       -                                                                                    54 (0 24 0 0)
197 Current_Pending_Sector  0x0012   100   100   000    Old_age   Always       -                                                                                    0
198 Offline_Uncorrectable   0x0010   100   100   000    Old_age   Offline      -                                                                                    0
199 UDMA_CRC_Error_Count    0x003e   200   200   000    Old_age   Always       -                                                                                    0
240 Head_Flying_Hours       0x0000   100   253   000    Old_age   Offline      -                                                                                    81651623264916
241 Total_LBAs_Written      0x0000   100   253   000    Old_age   Offline      -                                                                                    174738791963
242 Total_LBAs_Read         0x0000   100   253   000    Old_age   Offline      -                                                                                    8629080254

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA                                                                             _of_first_error
# 1  Extended offline    Self-test routine in progress 90%      1068         -
# 2  Short offline       Aborted by host               30%      1068         -

You can disable the smart using the following command.

root@tester [~]# smartctl -s off /dev/sda
smartctl 5.39.1 2010-01-28 r3054 [x86_64-unknown-linux-gnu] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF ENABLE/DISABLE COMMANDS SECTION ===
SMART Disabled. Use option -s with argument 'on' to enable it.


No comments: