5. Using smartctl

From Www


'smartctl' is the command line tool to get info and control the S.M.A.R.T. capable drive.


To start with you would probably want to query the status of your drive.  This command will print all S.M.A.R.T. info about the disk.


sudo smartctl -a /dev/hda


(You can figure out what hard drives your have by,

       Looking in your dmesg output

       Traversing your /proc/ide tree

       Or looking in /proc/partitions, this also give the partitions so not every device is is a different device )



Often you will need to turn on the S.M.A.R.T. abilities on your drive. (I am not sure, but I believe once you turn this on it could affect the booting of your computer.  I have see hard drives with problems cause PC's to get stuck on the BIOS startup, they get stuck on the BIOS with info about a drive that S.M.A.R.T. sees problems with.  So be *WARNED* )


sudo smartctl -s on -o on -S on /dev/hda


These options do

    '-s on' turns on S.M.A.R.T. for the drive

    '-o on' turns on automatic "testing" (might be better termed "data collection" rather than testing, per the smartctl manpage)

    '-S on' turns on S.M.A.R.T. autosave of device vendor-specific Attributes, this on



Then we can use the tool to start a selftest,


sudo smartctl -t long /dev/hda


There are several different tests that can be run,


There is a know issue with sata drives.  You need to force the smartmontools to treat the drive as a ata drive, with the -d ata option.  There are several -d options to force the smartctl to probe the drive.


Here is some example out with a drive of this type with and without the option.


 sudo smartctl  -a /dev/sda

smartctl version 5.36 [i686-pc-linux-gnu] Copyright (C) 2002-6 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

Device: ATA      HTS721010G9SA00  Version: MCZO
Serial number:       MPDZN7Y0J0G3RL
Device type: disk
Local Time is: Sat Jul 28 02:25:07 2007 CDT
Device does not support SMART

Error Counter logging not supported

[GLTSD (Global Logging Target Save Disable) set. Enable Save with '-S on']
Device does not support Self Test logging
bdolango@bdolango-laptop:~$ sudo smartctl  -a /dev/sda
smartctl version 5.36 [i686-pc-linux-gnu] Copyright (C) 2002-6 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

Device: ATA      HTS721010G9SA00  Version: MCZO
Serial number:       MPDZN7Y0J0G3RL
Device type: disk
Local Time is: Sat Jul 28 02:27:17 2007 CDT
Device does not support SMART

Error Counter logging not supported

[GLTSD (Global Logging Target Save Disable) set. Enable Save with '-S on']
Device does not support Self Test logging

sudo smartctl -d ata  -a /dev/sda


smartctl version 5.36 [i686-pc-linux-gnu] Copyright (C) 2002-6 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

Device: ATA      HTS721010G9SA00  Version: MCZO
Serial number:       MPDZN7Y0J0G3RL
Device type: disk
Local Time is: Sat Jul 28 02:27:17 2007 CDT
Device does not support SMART

Error Counter logging not supported

[GLTSD (Global Logging Target Save Disable) set. Enable Save with '-S on']
Device does not support Self Test logging
bdolango@bdolango-laptop:~$ sudo smartctl -d ata  -a /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:     HTS721010G9SA00
Serial Number:    MPDZN7Y0J0G3RL
Firmware Version: MCZOC12V
User Capacity:    100,030,242,816 bytes
Device is:        Not in smartctl database [for details use: -P showall]
ATA Version is:   7
ATA Standard is:  ATA/ATAPI-7 T13 1532D revision 1
Local Time is:    Sat Jul 28 02:28:21 2007 CDT
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x82) Offline data collection activity
                                        was completed without error.
                                        Auto Offline Data Collection: Enabled.
Self-test execution status:      (   0) The previous self-test routine completed
                                        without error or no self-test has ever
                                        been run.
Total time to complete Offline
data collection:                 ( 645) seconds.
Offline data collection
capabilities:                    (0x5b) SMART execute Offline immediate.
                                        Auto Offline data collection on/off support.
                                        Suspend Offline collection upon new
                                        command.
                                        Offline surface scan supported.
                                        Self-test supported.
                                        No Conveyance Self-test supported.
                                        Selective Self-test supported.
SMART capabilities:            (0x0003) Saves SMART data before entering
                                        power-saving mode.
                                        Supports SMART auto save timer.
Error logging capability:        (0x01) Error logging supported.
                                        General Purpose Logging supported.
Short self-test routine
recommended polling time:        (   2) minutes.
Extended self-test routine
recommended polling time:        (  50) minutes.

SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x000b   100   100   062    Pre-fail  Always       -       0
  2 Throughput_Performance  0x0005   115   100   040    Pre-fail  Offline      -       3427
  3 Spin_Up_Time            0x0007   217   100   033    Pre-fail  Always       -       1
  4 Start_Stop_Count        0x0012   100   100   000    Old_age   Always       -       82
  5 Reallocated_Sector_Ct   0x0033   100   100   005    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x000b   100   100   067    Pre-fail  Always       -       0
  8 Seek_Time_Performance   0x0005   114   100   040    Pre-fail  Offline      -       39
  9 Power_On_Hours          0x0012   099   099   000    Old_age   Always       -       477
 10 Spin_Retry_Count        0x0013   100   100   060    Pre-fail  Always       -       0
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       79
191 G-Sense_Error_Rate      0x000a   100   100   000    Old_age   Always       -       1
192 Power-Off_Retract_Count 0x0032   100   100   000    Old_age   Always       -       655366
193 Load_Cycle_Count        0x0012   100   100   000    Old_age   Always       -       2982
194 Temperature_Celsius     0x0002   137   100   000    Old_age   Always       -       40 (Lifetime Min/Max 21/46)
196 Reallocated_Event_Count 0x0032   100   100   000    Old_age   Always       -       0
197 Current_Pending_Sector  0x0022   100   100   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0008   100   100   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x000a   200   253   000    Old_age   Always       -       0

SMART Error Log Version: 1
No Errors Logged

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%         4         -
# 2  Short offline       Completed without error       00%         3         -
# 3  Short offline       Completed without error       00%         3         -
# 4  Short offline       Completed without error       00%         3         -
# 5  Short offline       Completed without error       00%         3         -
# 6  Short offline       Completed without error       00%         2         -
# 7  Short offline       Completed without error       00%         2         -
# 8  Short offline       Completed without error       00%         2         -
# 9  Short offline       Completed without error       00%         1         -
#10  Short offline       Completed without error       00%         1         -
#11  Short offline       Completed without error       00%         1         -
#12  Short offline       Completed without error       00%         1         -
#13  Short offline       Completed without error       00%         0         -
#14  Short offline       Completed without error       00%         0         -

Warning! SMART Selective Self-Test Log Structure error: invalid SMART checksum.
SMART Selective self-test log data structure revision number 1
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.



See more attached example log. (Future Meetings/20070728/Example Session)






Files (0)
 

Retrieved from "http://www.penguinsunbound.com/Past_Meetings/20070728_SMART/5._Using_smartctl"

Accessed 583 times.This page was last modified 07:27, 28 Jul 2007



Running DekiWiki-stable.