HDD S.M.A.R.T. Festplatten SMART in Linux Ubuntu abfragen
Aus znilwiki
smartmonttols installieren
Zunächst müssen dazu die smartmontools installiert sein:
apt-get install smartmontools
und danach sollte man die Datenbank der Festplatten welche die Tools nutzen aktualisieren:
update-smart-drivedb
Anzahl der Festplatten und Gerätenamen feststellen
Bevor wir nun die erste Festplatte abfragen sollten wir feststellen welche Festplatten es gibt und wo die eingehängt sind:
sed -ne 's/.*\([sh]d[a-zA-Z]\+$\)/\/dev\/\1/p' /proc/partitions
Bei meinem Server kommt da z.B. die Ausgabe
/dev/sda
Passt, ist ja auch nur eine Festplatte drin.
Die Ausgabe ist auch der Gerätename den wir nachfolgend verwenden müssen.
Unterstützt die Festplatte SMART?
Nun können wir testen ob die Festplatte überhaupt das Auslesen der SMART Daten unterstützt:
smartctl -i /dev/sda
Ergibt eine Ausgabe wie:
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.10.23-xxxx-std-ipv6-64] (local build) Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org === START OF INFORMATION SECTION === Model Family: Toshiba 3.5" HDD DT01ACA... Device Model: TOSHIBA DT01ACA100 Serial Number: 13OPK54GS LU WWN Device Id: 5 000039 ff2e5fb3d Firmware Version: MS2OA750 User Capacity: 1.000.204.886.016 bytes [1,00 TB] Sector Sizes: 512 bytes logical, 4096 bytes physical Rotation Rate: 7200 rpm Device is: In smartctl database [for details use: -P show] ATA Version is: ATA8-ACS T13/1699-D revision 4 SATA Version is: SATA 3.0, 6.0 Gb/s (current: 6.0 Gb/s) Local Time is: Thu Aug 7 20:19:52 2014 CEST SMART support is: Available - device has SMART capability. SMART support is: Enabled
Prima, ist in der Datenbank und wird unterstützt. Den genauen Datenbankeintrag bekommen wir mit
smartctl -P show /dev/sda
Ergebnis:
Drive found in smartmontools Database. Drive identity strings: MODEL: TOSHIBA DT01ACA100 FIRMWARE: MS2OA750 match smartmontools Drive Database entry: MODEL REGEXP: TOSHIBA DT01ACA(025|032|050|075|100|150|200|300) FIRMWARE REGEXP: .* MODEL FAMILY: Toshiba 3.5" HDD DT01ACA... ATTRIBUTE OPTIONS: None preset; no -v options are required.
Falls eine Meldung wie diese kommt:
/dev/sdb: Unknown USB bridge [0x1058:0x10b8 (0x1012)] Smartctl: please specify device type with the -d option.
probiert alle vorherigen und nachfolgenden Aufrufe mit einem zusätzlichen -d sat
:
smartctl -d sat -i /dev/sda
Alle Daten auslesen
Mit folgenden Befehl bekommen wir alle Informationen die es gibt:
smartctl -a /dev/sda
Beispiel:
=== START OF INFORMATION SECTION === Model Family: Toshiba 3.5" HDD DT01ACA... Device Model: TOSHIBA DT01ACA100 Serial Number: 13OPK54GS LU WWN Device Id: 5 000039 ff2e5fb3d Firmware Version: MS2OA750 User Capacity: 1.000.204.886.016 bytes [1,00 TB] Sector Sizes: 512 bytes logical, 4096 bytes physical Rotation Rate: 7200 rpm Device is: In smartctl database [for details use: -P show] ATA Version is: ATA8-ACS T13/1699-D revision 4 SATA Version is: SATA 3.0, 6.0 Gb/s (current: 6.0 Gb/s) Local Time is: Thu Aug 7 20:26:06 2014 CEST 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: (0x84) Offline data collection activity was suspended by an interrupting command from host. 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: ( 6973) 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: ( 1) minutes. Extended self-test routine recommended polling time: ( 117) minutes. SCT capabilities: (0x003d) SCT Status supported. SCT Error Recovery Control supported. SCT Feature Control supported. SCT Data Table supported. 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 016 Pre-fail Always - 0 2 Throughput_Performance 0x0005 141 141 054 Pre-fail Offline - 73 3 Spin_Up_Time 0x0007 127 127 024 Pre-fail Always - 182 (Average 180) 4 Start_Stop_Count 0x0012 100 100 000 Old_age Always - 29 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 115 115 020 Pre-fail Offline - 34 9 Power_On_Hours 0x0012 099 099 000 Old_age Always - 7060 10 Spin_Retry_Count 0x0013 100 100 060 Pre-fail Always - 0 12 Power_Cycle_Count 0x0032 100 100 000 Old_age Always - 29 192 Power-Off_Retract_Count 0x0032 100 100 000 Old_age Always - 53 193 Load_Cycle_Count 0x0012 100 100 000 Old_age Always - 53 194 Temperature_Celsius 0x0002 162 162 000 Old_age Always - 37 (Min/Max 16/45) 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 200 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% 6650 - # 2 Short offline Completed without error 00% 6647 - # 3 Short offline Completed without error 00% 5689 - # 4 Short offline Completed without error 00% 5688 - # 5 Short offline Completed without error 00% 5688 - # 6 Short offline Completed without error 00% 5688 - # 7 Short offline Completed without error 00% 5683 - # 8 Short offline Completed without error 00% 1751 - # 9 Short offline Completed without error 00% 1747 - #10 Short offline Completed without error 00% 1746 - #11 Short offline Completed without error 00% 29 - #12 Short offline Completed without error 00% 25 - #13 Short offline Completed without error 00% 25 - 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.
Meine Platte hier ist also schon mindestens 277 Tage im Betrieb.
Zusammenfassung aller Daten
Eine verkützte Ausgabe in der nur die Werte sind erhalten wir mit dem großen A:
smartctl -A /dev/sda
Ausgabe:
=== START OF READ SMART DATA SECTION === 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 016 Pre-fail Always - 0 2 Throughput_Performance 0x0005 141 141 054 Pre-fail Offline - 73 3 Spin_Up_Time 0x0007 127 127 024 Pre-fail Always - 182 (Average 180) 4 Start_Stop_Count 0x0012 100 100 000 Old_age Always - 29 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 115 115 020 Pre-fail Offline - 34 9 Power_On_Hours 0x0012 099 099 000 Old_age Always - 7063 10 Spin_Retry_Count 0x0013 100 100 060 Pre-fail Always - 0 12 Power_Cycle_Count 0x0032 100 100 000 Old_age Always - 29 192 Power-Off_Retract_Count 0x0032 100 100 000 Old_age Always - 53 193 Load_Cycle_Count 0x0012 100 100 000 Old_age Always - 53 194 Temperature_Celsius 0x0002 166 166 000 Old_age Always - 36 (Min/Max 16/45) 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 200 000 Old_age Always - 0
Nur Zustand abfragen
Wenn wir nur wissen wollen ob alles Ok ist:
smartctl -H /dev/sda
Ergebnis:
=== START OF READ SMART DATA SECTION === SMART overall-health self-assessment test result: PASSED
Auflistung der möglichen Selbsttests
smartctl -c /dev/sda
Ergebnis:
=== START OF READ SMART DATA SECTION === General SMART Values: Offline data collection status: (0x84) Offline data collection activity was suspended by an interrupting command from host. 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: ( 6973) 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: ( 1) minutes. Extended self-test routine recommended polling time: ( 117) minutes. SCT capabilities: (0x003d) SCT Status supported. SCT Error Recovery Control supported. SCT Feature Control supported. SCT Data Table supported.
Wie Ihr seht gibt es Zeitschätzung dazu wie lang der Test dauern würde.
Ergebnisse der letzten Tests abfragen
Welche Tests er mit welchen Ergebnis zuletzt gemacht hat seht Ihr mit
smartctl -l selftest /dev/sda
Ergebnis:
=== 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% 6650 - # 2 Short offline Completed without error 00% 6647 - # 3 Short offline Completed without error 00% 5689 - # 4 Short offline Completed without error 00% 5688 - # 5 Short offline Completed without error 00% 5688 - # 6 Short offline Completed without error 00% 5688 - # 7 Short offline Completed without error 00% 5683 - # 8 Short offline Completed without error 00% 1751 - # 9 Short offline Completed without error 00% 1747 - #10 Short offline Completed without error 00% 1746 - #11 Short offline Completed without error 00% 29 - #12 Short offline Completed without error 00% 25 - #13 Short offline Completed without error 00% 25 -
Temperatur abfragen
Warum auch immer .... in den vorherigen Werten wird die Temperatur mit "162" angegeben ... wie das in Grad umgerechnet wird weis ich nicht. Aber es gibt ein eigenes Programm dafür:
hddtemp /dev/sda
Ausgabe:
/dev/sda: TOSHIBA DT01ACA100: 35°C