Dmesg 抛出奇怪的 ATA 错误。设备突然挂起,出现打开的文件过多和 ATA 错误

Dmesg 抛出奇怪的 ATA 错误。设备突然挂起,出现打开的文件过多和 ATA 错误

我的设备开始变得非常慢,甚至在剩余大约 4 GB RAM(总共 8 GiB)的情况下也挂起了。我检查了 lsof,发现打开的文件数量异常多。这引起了对文件读写失败的怀疑,我发现 dmesg 每秒都会重复出现以下错误:

[ 2392.873599] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0
[ 2392.873608] ata1.00: irq_stat 0x40000001
[ 2392.873617] ata1.00: failed command: READ DMA EXT
[ 2392.873633] ata1.00: cmd 25/00:08:58:4a:af/00:00:15:00:00/e0 tag 26 dma 4096 in
                        res 51/40:00:58:4a:af/00:00:15:00:00/00 Emask 0x9 (media error)
[ 2392.873641] ata1.00: status: { DRDY ERR }
[ 2392.873646] ata1.00: error: { UNC }
[ 2393.006728] ata1.00: configured for UDMA/133
[ 2393.006748] sd 0:0:0:0: [sda] tag#26 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[ 2393.006752] sd 0:0:0:0: [sda] tag#26 Sense Key : Medium Error [current] 
[ 2393.006756] sd 0:0:0:0: [sda] tag#26 Add. Sense: Unrecovered read error - auto reallocate failed
[ 2393.006760] sd 0:0:0:0: [sda] tag#26 CDB: Read(10) 28 00 15 af 4a 58 00 00 08 00
[ 2393.006763] print_req_error: I/O error, dev sda, sector 363809368
[ 2393.006800] ata1: EH complete

有人建议我安装 smartmontools 并查看主驱动器的情况。因此,运行以下命令后:

smartctl -a /dev/sda

我得到了以下输出:

smartctl 6.5 2016-01-24 r4214 [x86_64-linux-4.15.0-32-generic] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Seagate Laptop Thin HDD
Device Model:     ST500LT012-9WS142
Serial Number:    S0V3G9Y7
LU WWN Device Id: 5 000c50 05bd9fc9c
Firmware Version: 0001LVM1
User Capacity:    500,107,862,016 bytes [500 GB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    5400 rpm
Form Factor:      2.5 inches
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ATA8-ACS T13/1699-D revision 4
SATA Version is:  SATA 2.6, 3.0 Gb/s (current: 1.5 Gb/s)
Local Time is:    Tue Aug 21 18:14:07 2018 IST
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
See vendor-specific Attribute list for marginal Attributes.

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:        (    0) 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:    (   1) minutes.
Extended self-test routine
recommended polling time:    ( 115) minutes.
Conveyance self-test routine
recommended polling time:    (   2) minutes.
SCT capabilities:          (0x1031) SCT Status supported.
                    SCT Feature Control supported.
                    SCT Data Table supported.

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   081   081   034    Pre-fail  Always       -       93541778
  3 Spin_Up_Time            0x0003   099   099   000    Pre-fail  Always       -       0
  4 Start_Stop_Count        0x0032   090   090   020    Old_age   Always       -       10274
  5 Reallocated_Sector_Ct   0x0033   100   100   036    Pre-fail  Always       -       24
  7 Seek_Error_Rate         0x000f   068   060   030    Pre-fail  Always       -       94638669551
  9 Power_On_Hours          0x0032   095   095   000    Old_age   Always       -       4497 (86 165 0)
 10 Spin_Retry_Count        0x0013   100   100   097    Pre-fail  Always       -       0
 12 Power_Cycle_Count       0x0032   098   098   020    Old_age   Always       -       2082
184 End-to-End_Error        0x0032   100   100   099    Old_age   Always       -       0
187 Reported_Uncorrect      0x0032   001   001   000    Old_age   Always       -       2819
188 Command_Timeout         0x0032   100   095   000    Old_age   Always       -       65546
189 High_Fly_Writes         0x003a   100   100   000    Old_age   Always       -       0
190 Airflow_Temperature_Cel 0x0022   058   040   045    Old_age   Always   In_the_past 42 (Min/Max 42/43 #88)
191 G-Sense_Error_Rate      0x0032   100   100   000    Old_age   Always       -       1218
192 Power-Off_Retract_Count 0x0032   100   100   000    Old_age   Always       -       186
193 Load_Cycle_Count        0x0032   069   069   000    Old_age   Always       -       62570
194 Temperature_Celsius     0x0022   042   060   000    Old_age   Always       -       42 (0 13 0 0 0)
196 Reallocated_Event_Count 0x000f   096   096   030    Pre-fail  Always       -       4224 (46039 0)
197 Current_Pending_Sector  0x0012   099   099   000    Old_age   Always       -       32
198 Offline_Uncorrectable   0x0010   099   099   000    Old_age   Offline      -       32
199 UDMA_CRC_Error_Count    0x003e   200   200   000    Old_age   Always       -       3
254 Free_Fall_Sensor        0x0032   100   100   000    Old_age   Always       -       0

SMART Error Log Version: 1
ATA Error Count: 3027 (device log contains only the most recent five errors)
    CR = Command Register [HEX]
    FR = Features Register [HEX]
    SC = Sector Count Register [HEX]
    SN = Sector Number Register [HEX]
    CL = Cylinder Low Register [HEX]
    CH = Cylinder High Register [HEX]
    DH = Device/Head Register [HEX]
    DC = Device Command Register [HEX]
    ER = Error register [HEX]
    ST = Status register [HEX]
Powered_Up_Time is measured from power on, and printed as
DDd+hh:mm:SS.sss where DD=days, hh=hours, mm=minutes,
SS=sec, and sss=millisec. It "wraps" after 49.710 days.

Error 3027 occurred at disk power-on lifetime: 4497 hours (187 days + 9 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 51 00 ff ff ff 0f  Error: UNC at LBA = 0x0fffffff = 268435455

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  25 00 08 ff ff ff ef 00      01:01:12.975  READ DMA EXT
  35 00 b0 ff ff ff ef 00      01:01:12.974  WRITE DMA EXT
  b0 d5 01 00 4f c2 00 00      01:01:12.973  SMART READ LOG
  27 00 00 00 00 00 e0 00      01:01:12.973  READ NATIVE MAX ADDRESS EXT [OBS-ACS-3]
  ec 00 00 00 00 00 a0 00      01:01:12.973  IDENTIFY DEVICE

Error 3026 occurred at disk power-on lifetime: 4497 hours (187 days + 9 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 51 00 ff ff ff 0f  Error: UNC at LBA = 0x0fffffff = 268435455

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  25 00 08 ff ff ff ef 00      01:01:10.285  READ DMA EXT
  35 00 28 ff ff ff ef 00      01:01:10.285  WRITE DMA EXT
  35 00 28 ff ff ff ef 00      01:01:10.284  WRITE DMA EXT
  ea 00 00 00 00 00 a0 00      01:01:10.284  FLUSH CACHE EXT
  b0 da 00 00 4f c2 00 00      01:01:10.229  SMART RETURN STATUS

Error 3025 occurred at disk power-on lifetime: 4497 hours (187 days + 9 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 51 00 ff ff ff 0f  Error: UNC at LBA = 0x0fffffff = 268435455

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  25 00 08 ff ff ff ef 00      01:01:07.518  READ DMA EXT
  35 00 10 ff ff ff ef 00      01:01:07.517  WRITE DMA EXT
  35 00 38 ff ff ff ef 00      01:01:07.517  WRITE DMA EXT
  35 00 40 ff ff ff ef 00      01:01:07.517  WRITE DMA EXT
  35 00 08 ff ff ff ef 00      01:01:07.516  WRITE DMA EXT

Error 3024 occurred at disk power-on lifetime: 4497 hours (187 days + 9 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 51 00 ff ff ff 0f  Error: UNC at LBA = 0x0fffffff = 268435455

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  25 00 08 ff ff ff ef 00      01:01:04.826  READ DMA EXT
  35 00 48 ff ff ff ef 00      01:01:04.825  WRITE DMA EXT
  b0 d0 01 00 4f c2 00 00      01:01:04.777  SMART READ DATA
  27 00 00 00 00 00 e0 00      01:01:04.777  READ NATIVE MAX ADDRESS EXT [OBS-ACS-3]
  ec 00 00 00 00 00 a0 00      01:01:04.776  IDENTIFY DEVICE

Error 3023 occurred at disk power-on lifetime: 4497 hours (187 days + 9 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 51 00 ff ff ff 0f  Error: UNC at LBA = 0x0fffffff = 268435455

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  25 00 08 ff ff ff ef 00      01:01:02.110  READ DMA EXT
  ea 00 00 00 00 00 a0 00      01:01:02.104  FLUSH CACHE EXT
  ec 00 01 00 00 00 00 00      01:01:02.103  IDENTIFY DEVICE
  27 00 00 00 00 00 e0 00      01:01:02.103  READ NATIVE MAX ADDRESS EXT [OBS-ACS-3]
  ec 00 00 00 00 00 a0 00      01:01:02.102  IDENTIFY DEVICE

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.

另一个答案暗示我的驱动器可能坏了,但我认为现在下结论还为时过早。有人能弄清楚这里发生了什么吗?

答案1

您的设备有一些坏扇区。坏扇区可能是由于意外断电、电缆损坏或撞击造成的。

因此有些扇区无法读取。但数量不多,所以您可以尝试修复。这需要读取所有磁盘扇区,找出坏扇区,然后写入坏扇区。有些程序可以执行此操作,例如:DOS 的 MHDD 或 Victoria,Linux 的 Hdrecover 或 WHDD。

这里最重要的智能参数。经过坏块测试后,它应该会改变。在良好的情况下,Current_Pending_Sector 变为 0。

5 Reallocated_Sector_Ct = 24 -- 已修复

197 Current_Pending_Sector = 32 -- 当前不可读

相关内容