坏块占用了很长时间-我做错了什么?

坏块占用了很长时间-我做错了什么?

我有一个 8TB 的 Seagate Archive 硬盘,上面有几个坏扇区。不过,我目前还负担不起更换它的费用。我暂时尝试使用坏块来“修复”它,但这需要很长时间:

# badblocks -b 4096 -nvs /dev/sdd
Checking for bad blocks in non-destructive read-write mode
From block 0 to 1953506645
Checking for bad blocks (non-destructive read-write test)
Testing with random pattern:  14.28% done, 82:45:36 elapsed. (0/0/0 errors)

它已经运行了 3.5 天,但只达到了 14%。应该还需要 21 天。我做错了什么?有没有可能让它运行得更快?

CPU 和 RAM 使用率似乎正常。

这是 SMART 报告:

# smartctl -a /dev/sdd       
smartctl 6.6 2017-11-05 r4594 [x86_64-linux-4.18.0-2-amd64] (local build)
Copyright (C) 2002-17, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Seagate Archive HDD
Device Model:     ST8000AS0002-1NA17Z
Serial Number:    #########
LU WWN Device Id: #########
Firmware Version: RT17
User Capacity:    8,001,563,222,016 bytes [8.00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    5980 rpm
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ACS-2, ACS-3 T13/2161-D revision 3b
SATA Version is:  SATA 3.1, 6.0 Gb/s (current: 3.0 Gb/s)
Local Time is:    Mon Aug 12 01:58:39 2019 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:  (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:    ( 957) minutes.
Conveyance self-test routine
recommended polling time:    (   2) minutes.
SCT capabilities:          (0x30b5) 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   113   099   006    Pre-fail  Always       -       53146800
  3 Spin_Up_Time            0x0003   093   090   000    Pre-fail  Always       -       0
  4 Start_Stop_Count        0x0032   100   100   020    Old_age   Always       -       536
  5 Reallocated_Sector_Ct   0x0033   100   100   010    Pre-fail  Always       -       16
  7 Seek_Error_Rate         0x000f   061   047   030    Pre-fail  Always       -       189036925963
  9 Power_On_Hours          0x0032   078   078   000    Old_age   Always       -       19486
 10 Spin_Retry_Count        0x0013   100   100   097    Pre-fail  Always       -       0
 12 Power_Cycle_Count       0x0032   098   098   020    Old_age   Always       -       2331
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   072   072   000    Old_age   Always       -       28
188 Command_Timeout         0x0032   100   100   000    Old_age   Always       -       0
189 High_Fly_Writes         0x003a   097   097   000    Old_age   Always       -       3
190 Airflow_Temperature_Cel 0x0022   058   052   045    Old_age   Always       -       42 (Min/Max 38/45)
191 G-Sense_Error_Rate      0x0032   100   100   000    Old_age   Always       -       0
192 Power-Off_Retract_Count 0x0032   054   054   000    Old_age   Always       -       92104
193 Load_Cycle_Count        0x0032   029   029   000    Old_age   Always       -       143183
194 Temperature_Celsius     0x0022   042   048   000    Old_age   Always       -       42 (0 17 0 0 0)
195 Hardware_ECC_Recovered  0x001a   113   099   000    Old_age   Always       -       53146800
197 Current_Pending_Sector  0x0012   094   094   000    Old_age   Always       -       2168
198 Offline_Uncorrectable   0x0010   094   094   000    Old_age   Offline      -       2168
199 UDMA_CRC_Error_Count    0x003e   200   200   000    Old_age   Always       -       0
240 Head_Flying_Hours       0x0000   100   253   000    Old_age   Offline      -       13141 (67 108 0)
241 Total_LBAs_Written      0x0000   100   253   000    Old_age   Offline      -       26109744918
242 Total_LBAs_Read         0x0000   100   253   000    Old_age   Offline      -       197934360042

SMART Error Log Version: 1
ATA Error Count: 28 (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 28 occurred at disk power-on lifetime: 19364 hours (806 days + 20 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 53 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
  -- -- -- -- -- -- -- --  ----------------  --------------------
  60 00 00 ff ff ff 4f 00      00:50:21.805  READ FPDMA QUEUED
  60 00 00 ff ff ff 4f 00      00:50:21.805  READ FPDMA QUEUED
  60 00 00 ff ff ff 4f 00      00:50:21.805  READ FPDMA QUEUED
  60 00 00 ff ff ff 4f 00      00:50:21.804  READ FPDMA QUEUED
  60 00 00 ff ff ff 4f 00      00:50:21.804  READ FPDMA QUEUED

Error 27 occurred at disk power-on lifetime: 19364 hours (806 days + 20 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 53 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
  -- -- -- -- -- -- -- --  ----------------  --------------------
  60 00 50 ff ff ff 4f 00      00:50:18.678  READ FPDMA QUEUED
  60 00 50 ff ff ff 4f 00      00:50:18.677  READ FPDMA QUEUED
  60 00 50 ff ff ff 4f 00      00:50:18.675  READ FPDMA QUEUED
  60 00 00 ff ff ff 4f 00      00:50:18.675  READ FPDMA QUEUED
  60 00 10 10 0a 00 40 00      00:50:18.674  READ FPDMA QUEUED

Error 26 occurred at disk power-on lifetime: 19364 hours (806 days + 20 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 53 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
  -- -- -- -- -- -- -- --  ----------------  --------------------
  60 00 50 ff ff ff 4f 00      00:50:15.772  READ FPDMA QUEUED
  60 00 50 ff ff ff 4f 00      00:50:15.771  READ FPDMA QUEUED
  60 00 50 ff ff ff 4f 00      00:50:15.768  READ FPDMA QUEUED
  60 00 50 ff ff ff 4f 00      00:50:15.765  READ FPDMA QUEUED
  60 00 10 ff ff ff 4f 00      00:50:15.751  READ FPDMA QUEUED

Error 25 occurred at disk power-on lifetime: 19364 hours (806 days + 20 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 53 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
  -- -- -- -- -- -- -- --  ----------------  --------------------
  60 00 50 ff ff ff 4f 00      00:50:12.728  READ FPDMA QUEUED
  60 00 00 ff ff ff 4f 00      00:50:12.727  READ FPDMA QUEUED
  60 00 00 ff ff ff 4f 00      00:50:12.726  READ FPDMA QUEUED
  60 00 00 ff ff ff 4f 00      00:50:12.724  READ FPDMA QUEUED
  60 00 00 ff ff ff 4f 00      00:50:12.723  READ FPDMA QUEUED

Error 24 occurred at disk power-on lifetime: 19364 hours (806 days + 20 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 53 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
  -- -- -- -- -- -- -- --  ----------------  --------------------
  60 00 10 ff ff ff 4f 00      00:50:06.069  READ FPDMA QUEUED
  60 00 10 ff ff ff 4f 00      00:50:06.069  READ FPDMA QUEUED
  60 00 10 10 0a 00 40 00      00:50:06.068  READ FPDMA QUEUED
  60 00 00 ff ff ff 4f 00      00:50:06.068  READ FPDMA QUEUED
  60 00 00 ff ff ff 4f 00      00:50:06.068  READ FPDMA QUEUED

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Extended offline    Completed: read failure       10%      9998         -
# 2  Extended offline    Interrupted (host reset)      00%      9983         -
# 3  Short offline       Completed without error       00%      2566         -
# 4  Short offline       Completed without error       00%      2431         -

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.

我唯一能想到的是,该驱动器是 SATA 3(6 Gbps),而当前安装它的计算机仅支持 SATA 2(3 Gbps)。我不认为这是问题所在,不过,24 天似乎太长了。

答案1

初步说明:由于Reallocated_Sector_Ct和相当大,Current_Pending_Sector在尝试使用“修复”磁盘之前,我会备份所有重要数据badblocks


man 8 badblocks

-b block_size
指定块的大小(以字节为单位)。默认值为1024

-c number of blocks
是一次测试的块数。默认值为64

您的选择-b是明智的:4096很可能是您设备的物理扇区大小。

您的选择(缺乏)-c就没那么幸运了。默认值使badblocks操作在 64 × 4096 = 256k 的块上进行。

考虑到非破坏性读写测试的badblocks工作原理,我声明该工具需要按顺序读取 256k、写入 256k、读取 256k 和写入 256k 到磁盘的同一区域。并且的整个目的badblocks要求它绕过它可以绕过的任何缓存;否则会优化此类操作的缓存。

从这四个动作来看,第一个读取可能来自缓存,最后一个写入理论上可能被缓存并推迟;但第一个写入操作和第二个读取操作必须与磁盘盘片进行物理交互。也许所有四个操作都需要。写入和读取如此小的块会使整个过程变慢。

考虑-c大幅增加。我会选择至少40968192;它们会分别给我 16M 或 32M 的块。

如果badblocks在一个物理扇区中遇到写入错误,我希望它将数据写入块的所有其他扇区(与丢弃整个块相反);因此只有最少量的数据丢失。磁盘可能会重新映射故障扇区,因此不会丢失任何数据。在这种情况下,大块应该和小块一样安全。我承认我没有测试过这一点。

但如果发生任何严重故障(例如断电),则可能会导致整个块(或部分块)损坏。在这种情况下,小块更安全。


如果我是你,我会考虑以下步骤:

  1. 用于iotop了解当前进程的具体速度badblocks
  2. 暂停badblocks进程(Ctrl+ Z)。badblocks应该足够智能,可以在块之间暂停,而不是在处理块的中间暂停。
  3. badblocks在单独的控制台中运行另一个,这次使用较大的-c
  4. 用 监控其性能iotop
  5. 决定下一步做什么:
    • 如果新的速度badblocks不是更快:
      1. 轻轻地终止新的badblocksCtrl+ C);该工具应该足够智能,可以在块之间终止,而不是在处理块的中间终止。
      2. 返回旧控制台并恢复旧badblocksfg)。
    • 如果新的badblocks更快:
      1. 返回旧控制台并终止旧的badblockskill %+)。
      2. 让新的badblocks工作更快完成。

相关内容