如何验证 smartctl 错误是否已修复?

如何验证 smartctl 错误是否已修复?

根据简短的测试结果,我的硬盘驱动器出现了一些错误smartctl(见下文)。

然后,出于隐私原因,我首先将磁盘上的数据清零:

sudo dd if=/dev/zero of=/dev/sdc1 bs=1M
sudo dd if=/dev/zero of=/dev/sdc2 bs=1M

然后,我重新分区成1个大分区,然后我尝试使用xfs_repiar来修复错误:sudo xfs_repair /dev/sdc;不过,最后它打印了:

Sorry, could not find valid secondary superblock
Exiting now.

然后我跑了sudo smartctl -t short /dev/sdc

smartctl 7.0 2018-12-30 r4883 [x86_64-linux-5.17.0-1.el7.elrepo.x86_64] (local build)
Copyright (C) 2002-18, Bruce Allen, Christian Franke, www.smartmontools.org

=== 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 1 minutes for test to complete.
Test will complete after Wed Jan 25 19:17:48 2023

Use smartctl -X to abort test.
[hc@hclinux22 src]$ sudo smartctl -a /dev/sdc
smartctl 7.0 2018-12-30 r4883 [x86_64-linux-5.17.0-1.el7.elrepo.x86_64] (local build)
Copyright (C) 2002-18, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Device Model:     ST2000DM008-2FR102
Serial Number:    [masked off]
LU WWN Device Id: 5 000c50 0bf3bfc3b
Firmware Version: 0001
User Capacity:    2,000,398,934,016 bytes [2.00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    7200 rpm
Form Factor:      3.5 inches
Device is:        Not in smartctl database [for details use: -P showall]
ATA Version is:   ACS-3 T13/2161-D revision 5
SATA Version is:  SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Wed Jan 25 19:16:53 2023 HKT
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:      ( 249) Self-test routine in progress...
                    90% of test remaining.
Total time to complete Offline 
data collection:        (    0) seconds.
Offline data collection
capabilities:            (0x73) SMART execute Offline immediate.
                    Auto Offline data collection on/off support.
                    Suspend Offline collection upon new
                    command.
                    No 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:    ( 198) minutes.
Conveyance self-test routine
recommended polling time:    (   2) minutes.
SCT capabilities:          (0x30a5) SCT Status 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   100   053   006    Pre-fail  Always       -       0
  3 Spin_Up_Time            0x0003   098   097   000    Pre-fail  Always       -       0
  4 Start_Stop_Count        0x0032   100   100   020    Old_age   Always       -       688
  5 Reallocated_Sector_Ct   0x0033   099   099   010    Pre-fail  Always       -       2720
  7 Seek_Error_Rate         0x000f   079   060   045    Pre-fail  Always       -       86398239
  9 Power_On_Hours          0x0032   099   099   000    Old_age   Always       -       1741 (180 187 0)
 10 Spin_Retry_Count        0x0013   100   100   097    Pre-fail  Always       -       0
 12 Power_Cycle_Count       0x0032   100   100   020    Old_age   Always       -       688
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   001   001   000    Old_age   Always       -       4501
188 Command_Timeout         0x0032   100   099   000    Old_age   Always       -       12885098499
189 High_Fly_Writes         0x003a   100   100   000    Old_age   Always       -       0
190 Airflow_Temperature_Cel 0x0022   066   059   040    Old_age   Always       -       34 (Min/Max 20/34)
191 G-Sense_Error_Rate      0x0032   100   100   000    Old_age   Always       -       0
192 Power-Off_Retract_Count 0x0032   100   100   000    Old_age   Always       -       24
193 Load_Cycle_Count        0x0032   079   079   000    Old_age   Always       -       42048
194 Temperature_Celsius     0x0022   034   041   000    Old_age   Always       -       34 (0 17 0 0 0)
195 Hardware_ECC_Recovered  0x001a   100   064   000    Old_age   Always       -       0
197 Current_Pending_Sector  0x0012   100   098   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0010   100   098   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x003e   200   200   000    Old_age   Always       -       0
240 Head_Flying_Hours       0x0000   100   253   000    Old_age   Offline      -       1272 (103 165 0)
241 Total_LBAs_Written      0x0000   100   253   000    Old_age   Offline      -       8760463243
242 Total_LBAs_Read         0x0000   100   253   000    Old_age   Offline      -       22589260799

SMART Error Log Version: 1
ATA Error Count: 4501 (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 4501 occurred at disk power-on lifetime: 1727 hours (71 days + 23 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 08 ff ff ff 4f 00      01:38:29.788  READ FPDMA QUEUED
  ef 10 02 00 00 00 a0 00      01:38:29.778  SET FEATURES [Enable SATA feature]
  27 00 00 00 00 00 e0 00      01:38:29.752  READ NATIVE MAX ADDRESS EXT [OBS-ACS-3]
  ec 00 00 00 00 00 a0 00      01:38:29.750  IDENTIFY DEVICE
  ef 03 46 00 00 00 a0 00      01:38:29.737  SET FEATURES [Set transfer mode]

Error 4500 occurred at disk power-on lifetime: 1727 hours (71 days + 23 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 08 ff ff ff 4f 00      01:38:29.638  READ FPDMA QUEUED
  ef 10 02 00 00 00 a0 00      01:38:29.628  SET FEATURES [Enable SATA feature]
  27 00 00 00 00 00 e0 00      01:38:29.602  READ NATIVE MAX ADDRESS EXT [OBS-ACS-3]
  ec 00 00 00 00 00 a0 00      01:38:29.600  IDENTIFY DEVICE
  ef 03 46 00 00 00 a0 00      01:38:29.588  SET FEATURES [Set transfer mode]

Error 4499 occurred at disk power-on lifetime: 1727 hours (71 days + 23 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 08 ff ff ff 4f 00      01:38:29.481  READ FPDMA QUEUED
  60 00 00 ff ff ff 4f 00      01:38:27.087  READ FPDMA QUEUED
  60 00 00 ff ff ff 4f 00      01:38:23.902  READ FPDMA QUEUED
  60 00 80 ff ff ff 4f 00      01:38:23.008  READ FPDMA QUEUED
  60 00 40 ff ff ff 4f 00      01:38:23.008  READ FPDMA QUEUED

Error 4498 occurred at disk power-on lifetime: 1727 hours (71 days + 23 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 08 ff ff ff 4f 00      01:38:13.746  READ FPDMA QUEUED
  ea 00 00 00 00 00 a0 00      01:38:13.728  FLUSH CACHE EXT
  61 00 78 ff ff ff 4f 00      01:38:13.725  WRITE FPDMA QUEUED
  61 00 c0 ff ff ff 4f 00      01:38:13.724  WRITE FPDMA QUEUED
  ef 10 02 00 00 00 a0 00      01:38:13.715  SET FEATURES [Enable SATA feature]

Error 4497 occurred at disk power-on lifetime: 1727 hours (71 days + 23 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 08 ff ff ff 4f 00      01:38:13.519  READ FPDMA QUEUED
  61 00 c0 ff ff ff 4f 00      01:38:13.519  WRITE FPDMA QUEUED
  61 00 40 ff ff ff 4f 00      01:38:13.519  WRITE FPDMA QUEUED
  61 00 d0 ff ff ff 4f 00      01:38:13.519  WRITE FPDMA QUEUED
  61 00 40 ff ff ff 4f 00      01:38:13.518  WRITE FPDMA QUEUED

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Short offline       Self-test routine in progress 90%      1741         -
# 2  Short offline       Completed without error       00%      1739         -
# 3  Short offline       Completed without error       00%      1737         -
# 4  Short offline       Completed: read failure       90%      1709         3894432032

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.

之前的错误仍然存​​在。

如果错误保留在“日志”中但已被修复,我该如何验证?

如果上述错误确实存在,我该如何修复并验证?我不关心驱动器,但我想看看是否可以修复错误,然后磁盘保持“可靠”。

谢谢!

===========================

更新:

$ sudo parted /dev/sdc unit MiB print
Model: ATA ST2000DM008-2FR1 (scsi)
Disk /dev/sdc: 1907729MiB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: 

Number  Start    End         Size        File system  Name  Flags
 1      1.00MiB  1907729MiB  1907728MiB  xfs

是的,当我在擦除 sdc1 和 sdc2 后重新分区时,我为该分区创建了一个 xfs:

$ ll /dev/sdc2
ls: cannot access /dev/sdc2: No such file or directory
$ ll /dev/sdc1
brw-rw----. 1 root disk 8, 33 Jan 25 19:46 /dev/sdc1

答案1

首先也是最重要的,这里存在某种硬件错误。检查所有电缆是否均已就位(如果是 USB,则端口是否为驱动器提供足够的电力):

188 Command_Timeout         0x0032   100   099   000    Old_age   Always       -       12885098499

其次,您的磁盘有一个故障区域,并且正在(当前成功)将扇区重新映射到其备用区域。但迟早,它会耗尽备用扇区,并且您将开始看到数据中的错误:

  5 Reallocated_Sector_Ct   0x0033   099   099   010    Pre-fail  Always       -       2720

现在,让我们看看您做了什么回应。

  1. 删除了/dev/sdc1磁盘上第一个分区中的所有内容
  2. 删除了/dev/sdc2磁盘上第二个分区中的所有内容
  3. 尝试修复不在分区中但占用整个磁盘的 XFS 文件系统/dev/sdc

如果您已删除分区 1 和 2 中的数据,则不再有可访问的数据。但是,如果您有分区表,那么该分区表之外的磁盘上不太可能有文件系统(XFS 或其他)。更有可能的是,您已经删除了数据并且没有文件系统需要修复,或者可能只是/dev/sdc3.

在您更新的问题中,分区表仅显示一个分区/dev/sdc1。如果您向我们展示的内容是准确的,这意味着您之前dd将创建一个名为/dev/sdc2- 的大文件,并且由于文件大小没有限制,您将填满您的/dev分区,并且dd应该报告此错误。用于ls -l /dev/sdc2检查它是文件还是设备,如果并且仅当它是一个文件,然后使用 删除它rm /dev/sdc2

另一方面,如果/dev/sdc2被列为设备或丢失,那么您向我们展示的分区表不是您在问题的其余部分中描述的分区表。

相关内容