3

I have a 8TB Seagate Archive drive which has a few bad sectors. I can't afford to replace it yet, though. I'm trying to "fix it" with badblocks for the time being, but it's taking ages:

# 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)

It's been running for 3.5 days and it only reached 14%. It should take 21 more days. What am I doing wrong? Is it possible to make it go faster?

CPU and RAM usage seems normal.

This is the SMART report:

# 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.

The only thing I can think of is that the drive is SATA 3 (6 Gbps), while the computer in which it is currently installed only supports SATA 2 (3 Gbps). I don't think that is the problem, though, 24 days seems too excessive.

stevereds
  • 135

1 Answers1

9

Preliminary note: because of Reallocated_Sector_Ct and quite large Current_Pending_Sector I would backup all the important data before trying to "fix" the disk with badblocks.


From man 8 badblocks:

-b block_size
Specify the size of blocks in bytes. The default is 1024.

-c number of blocks
is the number of blocks which are tested at a time. The default is 64.

Your choice for -b is sane: 4096 is most probably the physical sector size of your device.

Your (lack of) choice of -c is far less fortunate. The default value makes badblocks operate on chunks of 64 × 4096 = 256k.

Considering how the non-destructive read-write test in badblocks works, I state that the tool needs to read 256k, write 256k, read 256k and write 256k in sequence to the same area of the disk. And the whole purpose of badblocks requires it to bypass any cache it can; cache that would otherwise optimize such operations.

From these four actions the first read may be from the cache and the last write in theory may be cached and postponed; but the first write operation and the second read operation must physically interact with the disk platters. Maybe all four do. Writing and reading such small chunks makes the whole process slow.

Consider increasing -c significantly. I would go with at least 4096 or 8192; these would give me chunks of 16M or 32M respectively.

If badblocks encounters a write error in one physical sector, I will expect it to write data to all other sectors of the chunk back (as opposite from discarding the whole chunk); so only the minimal amount of data is lost. The disk may remap the faulty sector anyway, so the chance is no data is lost. In this context a large chunk should be as safe as a small one. I admit I haven't tested this though.

But if any critical failure occurs (e.g. a power outage) then you may end up with the whole chunk (or a part of it) corrupted. In this context small chunks are safer.


If I were you, I would consider the following procedure:

  1. Use iotop to know how fast exactly the current badblocks process is.
  2. Suspend the badblocks process (Ctrl+Z). badblocks should be smart enough to suspend between chunks, not in the middle of processing one.
  3. Run another badblocks in a separate console, this time with large -c.
  4. Monitor its performance with iotop.
  5. Decide what to do next:
    • If the new badblocks is not much faster:
      1. Terminate the new badblocks gently (Ctrl+C); the tool should be smart enough to terminate between chunks, not in the middle of processing one.
      2. Go back to the old console and resume the old badblocks (fg).
    • If the new badblocks is much faster:
      1. Go back to the old console and terminate the old badblocks (kill %+).
      2. Let the new badblocks work much faster.