Analyse einer fehlerhaften Festplatte mit smartctl

Aus Thomas-Krenn-Wiki
Zur Navigation springen Zur Suche springen

Mit smartctl können Sie unter Linux die SMART Werte von Festplatten auslesen. In diesem Beispiel zeigen wir die Analyse einer defekten Festplatte. Die Festplatte in diesem Beispiel kann mehrere Sektoren nicht mehr lesen und ist somit defekt. Sie muss damit ausgetauscht werden.

SMART Informationen anzeigen

smartctl -a /dev/DEVICENAME zeigt Ihnen alle SMART Informationen der betroffenen Festplatte. Die Festplatte in diesem Beispiel zeigt bei mehreren SMART Attributen erhöhte Fehlerwerte:

root@ubuntu-10-10:~# smartctl -a /dev/sdb
smartctl 5.40 2010-03-16 r3077 [x86_64-unknown-linux-gnu] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF INFORMATION SECTION ===
Model Family:     SAMSUNG SpinPoint F2 EG series
Device Model:     SAMSUNG HD502HI
Serial Number:    S1VZJ9CS712490
Firmware Version: 1AG01118
User Capacity:    500,107,862,016 bytes
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   8
ATA Standard is:  ATA-8-ACS revision 3b
Local Time is:    Wed Feb  9 15:30:42 2011 CET
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:  (0x00)    Offline data collection activity
                    was never started.
                    Auto Offline Data Collection: Disabled.
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:          (6312) seconds.
Offline data collection
capabilities:              (0x7b) SMART execute Offline immediate.
                    Auto Offline data collection on/off support.
                    Suspend Offline collection upon new
                    command.
                    Offline surface scan supported.
                    Self-test supported.
                    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:      ( 106) minutes.
Conveyance self-test routine
recommended polling time:      (  12) minutes.
SCT capabilities:            (0x003f)    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     0x000f   099   099   051    Pre-fail  Always       -       2376
  3 Spin_Up_Time            0x0007   091   091   011    Pre-fail  Always       -       3620
  4 Start_Stop_Count        0x0032   100   100   000    Old_age   Always       -       405
  5 Reallocated_Sector_Ct   0x0033   100   100   010    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x000f   253   253   051    Pre-fail  Always       -       0
  8 Seek_Time_Performance   0x0025   100   100   015    Pre-fail  Offline      -       0
  9 Power_On_Hours          0x0032   100   100   000    Old_age   Always       -       717
 10 Spin_Retry_Count        0x0033   100   100   051    Pre-fail  Always       -       0
 11 Calibration_Retry_Count 0x0012   100   100   000    Old_age   Always       -       0
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       405
 13 Read_Soft_Error_Rate    0x000e   099   099   000    Old_age   Always       -       2375
183 Runtime_Bad_Block       0x0032   100   100   000    Old_age   Always       -       0
184 End-to-End_Error        0x0033   100   100   000    Pre-fail  Always       -       0
187 Reported_Uncorrect      0x0032   100   100   000    Old_age   Always       -       2375
188 Command_Timeout         0x0032   100   100   000    Old_age   Always       -       0
190 Airflow_Temperature_Cel 0x0022   084   074   000    Old_age   Always       -       16 (Lifetime Min/Max 16/16)
194 Temperature_Celsius     0x0022   084   071   000    Old_age   Always       -       16 (Lifetime Min/Max 16/16)
195 Hardware_ECC_Recovered  0x001a   100   100   000    Old_age   Always       -       3558
196 Reallocated_Event_Count 0x0032   100   100   000    Old_age   Always       -       0
197 Current_Pending_Sector  0x0012   098   098   000    Old_age   Always       -       81
198 Offline_Uncorrectable   0x0030   100   100   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x003e   100   100   000    Old_age   Always       -       1
200 Multi_Zone_Error_Rate   0x000a   100   100   000    Old_age   Always       -       0
201 Soft_Read_Error_Rate    0x000a   253   253   000    Old_age   Always       -       0

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
No self-tests have been logged.  [To run self-tests, use: smartctl -t]


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.

root@ubuntu-10-10:~#

Analyse

Für die nähere Analyse sind in diesem Beispiel folgende Werte interessant:

  1 Raw_Read_Error_Rate     0x000f   099   099   051    Pre-fail  Always       -       2376
 13 Read_Soft_Error_Rate    0x000e   099   099   000    Old_age   Always       -       2375
187 Reported_Uncorrect      0x0032   100   100   000    Old_age   Always       -       2375
195 Hardware_ECC_Recovered  0x001a   100   100   000    Old_age   Always       -       3558
197 Current_Pending_Sector  0x0012   098   098   000    Old_age   Always       -       81
199 UDMA_CRC_Error_Count    0x003e   100   100   000    Old_age   Always       -       1

Der RAW_VALUE Wert von Current_Pending_Sector gibt an wieviele Sektoren von der Festplatte nicht mehr gelesen werden konnten und auf ein Remapping warten.[1] Detailinformationen zu den anderen Fehlerwerten finden Sie im Abschnitt ATA S.M.A.R.T. attributes des Wikipedia-Artikels zu SMART.[2]

SMART Tests

SMART unterstützt mehrere Festplattentests. Details finden Sie in der Manpage von smartctl.

short Test

Im Beispiel starten wir einen short Test:

root@ubuntu-10-10:~# smartctl -t short /dev/sdb
smartctl 5.40 2010-03-16 r3077 [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 2 minutes for test to complete.
Test will complete after Wed Feb  9 15:35:31 2011

Use smartctl -X to abort test.
root@ubuntu-10-10:~#

Testergebnis anzeigen

Mit smartctl -l selftest /dev/sdb werden die Ergebnisse des Tests angezeigt. Im Beispiel ist die LBA Adresse des ersten fehlerhaften Sektors ersichtlich.

root@ubuntu-10-10:~# smartctl -l selftest /dev/sdb
smartctl 5.40 2010-03-16 r3077 [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 Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Short offline       Completed: read failure       20%       717         555027747

root@ubuntu-10-10:~#

Current_Pending_Sector reduzieren

Durch das Schreiben von neuen Daten auf einen fehlerhaften Sektor ist es möglich den Current_Pending_Sector zu reduzieren. Der ursprüngliche Inhalt des Sektors geht dabei verloren. Details dazu finden Sie im Bad block HOWTO.[3]

Abhängig vom jeweiligen Festplattenmodell und der Festplattenfirmware wird beim Schreiben auf einen defekten Sektor zuerst versucht, direkt auf den betroffenen Sektor zu schreiben und - wenn dieses Schreiben erfolgreich ist - der Current_Pending_Sector reduziert oder sofort ein Remapping des fehlerhaften Sektors durchgeführt.[4]

Erneutes Beschreiben des fehlerhaften Sektors

Bei der Western Digital RE4 Festplatte im folgenden Beispiel sind drei fehlerhafte Sektoren in einer Partition, die ein ein Software RAID für ein Swap-Device enthält. Das Swap-Device wurde in diesem Beispiel zuvor deaktiviert, somit kann die betroffene Partition in diesem konkreten Beispiel mit dd überschrieben und gelöscht werden. Das Beschreiben der drei fehlerhaften Sektoren ist dabei erfolgreich. Die Firmware dieser Festplatte führt in diesem Fall kein Remapping durch:

root@wc2:~# smartctl -a /dev/sdb
smartctl 5.41 2011-06-09 r3365 [x86_64-linux-3.2.0-60-generic] (local build)
Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF INFORMATION SECTION ===
Model Family:     Western Digital RE4
Device Model:     WDC WD1003FBYX-01Y7B0
Serial Number:    WD-WCAW32925193
LU WWN Device Id: 5 0014ee 25b95b881
Firmware Version: 01.01V01
User Capacity:    1,000,204,886,016 bytes [1.00 TB]
Sector Size:      512 bytes logical/physical
[...]
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x002f   200   200   051    Pre-fail  Always       -       0
  3 Spin_Up_Time            0x0027   172   171   021    Pre-fail  Always       -       4358
  4 Start_Stop_Count        0x0032   100   100   000    Old_age   Always       -       123
  5 Reallocated_Sector_Ct   0x0033   200   200   140    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x002e   100   253   000    Old_age   Always       -       0
  9 Power_On_Hours          0x0032   081   081   000    Old_age   Always       -       14045
 10 Spin_Retry_Count        0x0032   100   100   000    Old_age   Always       -       0
 11 Calibration_Retry_Count 0x0032   100   100   000    Old_age   Always       -       0
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       120
192 Power-Off_Retract_Count 0x0032   200   200   000    Old_age   Always       -       67
193 Load_Cycle_Count        0x0032   200   200   000    Old_age   Always       -       55
194 Temperature_Celsius     0x0022   120   106   000    Old_age   Always       -       27
196 Reallocated_Event_Count 0x0032   200   200   000    Old_age   Always       -       0
197 Current_Pending_Sector  0x0032   200   200   000    Old_age   Always       -       4
[...]
root@wc2:~# dd if=/dev/zero of=/dev/md2 bs=1M
dd: writing `/dev/md2': No space left on device

7629+0 records in
7628+0 records out
7998939136 bytes (8.0 GB) copied, 85.3431 s, 93.7 MB/s
root@wc2:~# smartctl -a /dev/sdb
smartctl 5.41 2011-06-09 r3365 [x86_64-linux-3.2.0-60-generic] (local build)
Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF INFORMATION SECTION ===
Model Family:     Western Digital RE4
Device Model:     WDC WD1003FBYX-01Y7B0
[...]
  1 Raw_Read_Error_Rate     0x002f   200   200   051    Pre-fail  Always       -       0
  3 Spin_Up_Time            0x0027   172   171   021    Pre-fail  Always       -       4358
  4 Start_Stop_Count        0x0032   100   100   000    Old_age   Always       -       123
  5 Reallocated_Sector_Ct   0x0033   200   200   140    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x002e   100   253   000    Old_age   Always       -       0
  9 Power_On_Hours          0x0032   081   081   000    Old_age   Always       -       14045
 10 Spin_Retry_Count        0x0032   100   100   000    Old_age   Always       -       0
 11 Calibration_Retry_Count 0x0032   100   100   000    Old_age   Always       -       0
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       120
192 Power-Off_Retract_Count 0x0032   200   200   000    Old_age   Always       -       67
193 Load_Cycle_Count        0x0032   200   200   000    Old_age   Always       -       55
194 Temperature_Celsius     0x0022   120   106   000    Old_age   Always       -       27
196 Reallocated_Event_Count 0x0032   200   200   000    Old_age   Always       -       0
197 Current_Pending_Sector  0x0032   200   200   000    Old_age   Always       -       1
198 Offline_Uncorrectable   0x0030   200   200   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x0032   200   200   000    Old_age   Always       -       0
200 Multi_Zone_Error_Rate   0x0008   200   200   000    Old_age   Offline      -       0
[...]

Remapping eines fehlerhaften Sektors

Die folgenden Kommandos zeigen das Remapping eines Sektors bei der SAMSUNG HD502HI Festplatte, der Current_Pending_Sector Zähler sinkt (die Schritte wurden entsprechend des Bad Block HOWTOs durchgeführt):

root@ubuntu-10-10:~# fdisk -lu /dev/sdb

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x20d1585d

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *        2048      206847      102400    7  HPFS/NTFS
Partition 1 does not end on cylinder boundary.
/dev/sdb2          206848    97863097    48828125    7  HPFS/NTFS
/dev/sdb3        97868041   976768064   439450012    5  Extended
/dev/sdb5        97868043   964703249   433417603+  83  Linux
/dev/sdb6       964703313   976768064     6032376   82  Linux swap / Solaris
root@ubuntu-10-10:~# tune2fs -l /dev/sdb5 | grep Block
Block count:              108354400
Block size:               4096
Blocks per group:         32768
root@ubuntu-10-10:~# debugfs 
debugfs 1.41.12 (17-May-2010)
debugfs:  open /dev/sdb5
debugfs:  testb 57144963
Block 57144963 not in use
debugfs:  quit
root@ubuntu-10-10:~# dd if=/dev/zero of=/dev/sdb5 bs=4096 count=1 seek=57144963
1+0 records in
1+0 records out
4096 bytes (4,1 kB) copied, 0,000379164 s, 10,8 MB/s
root@ubuntu-10-10:~# sync
root@ubuntu-10-10:~# smartctl -A /dev/sdb
smartctl 5.40 2010-03-16 r3077 [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: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
[...]
197 Current_Pending_Sector  0x0012   098   098   000    Old_age   Always       -       80
[...]

Ein weiterer Testdurchlauf wird gestartet und ebenfalls wieder ein Remapping durchgeführt:

root@ubuntu-10-10:~# smartctl -t short /dev/sdb
smartctl 5.40 2010-03-16 r3077 [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 2 minutes for test to complete.
Test will complete after Wed Feb  9 15:47:41 2011

Use smartctl -X to abort test.
root@ubuntu-10-10:~# smartctl -l selftest /dev/sdb
smartctl 5.40 2010-03-16 r3077 [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 Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Short offline       Completed: read failure       20%       717         555027784
# 2  Short offline       Completed: read failure       20%       717         555027747

root@ubuntu-10-10:~# debugfs 
debugfs 1.41.12 (17-May-2010)
debugfs:  open /dev/sdb5
debugfs:  testb 57144967
Block 57144967 not in use
debugfs:  quit
root@ubuntu-10-10:~# dd if=/dev/zero of=/dev/sdb5 bs=4096 count=1 seek=57144967
1+0 records in
1+0 records out
4096 bytes (4,1 kB) copied, 0,000374713 s, 10,9 MB/s
root@ubuntu-10-10:~# smartctl -A /dev/sdb
smartctl 5.40 2010-03-16 r3077 [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: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
[...]
197 Current_Pending_Sector  0x0012   098   098   000    Old_age   Always       -       79
[...]

Einzelnachweise

  1. 9133: S.M.A.R.T. Attribute: Current Pending Sector Count (Acronis Knowledge Base)
  2. S.M.A.R.T. (en.wikipedia.org)
  3. Bad block HOWTO for smartmontools
  4. S.M.A.R.T. (en.wikipedia.org) However some drives will not immediately remap such sectors when written; instead the drive will first attempt to write to the problem sector and if the write operation is successful then the sector will be marked good (in this case, the "Reallocation Event Count" (0xC4) will not be increased).

Weitere Informationen


Foto Werner Fischer.jpg

Autor: Werner Fischer

Werner Fischer arbeitet im Product Management Team von Thomas-Krenn. Er evaluiert dabei neueste Technologien und teilt sein Wissen in Fachartikeln, bei Konferenzen und im Thomas-Krenn Wiki. Bereits 2005 - ein Jahr nach seinem Abschluss des Studiums zu Computer- und Mediensicherheit an der FH Hagenberg - heuerte er beim bayerischen Server-Hersteller an. Als Öffi-Fan nutzt er gerne Bus & Bahn und genießt seinen morgendlichen Spaziergang ins Büro.


Das könnte Sie auch interessieren

SMART
SMART Tests mit smartctl
SMART Werte von NVMe SSDs auslesen