![这个硬盘还能用吗?](https://linux22.com/image/914449/%E8%BF%99%E4%B8%AA%E7%A1%AC%E7%9B%98%E8%BF%98%E8%83%BD%E7%94%A8%E5%90%97%EF%BC%9F.png)
我想检查旧硬盘从较低高度(约 20 厘米)掉落后的健康状况。smartctl -l selftest
记录了以下自我测试:
=== 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 90% 10728 225080
但是smartctl -A
给出了以下输出:
=== 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
1 Raw_Read_Error_Rate 0x002f 100 100 051 Pre-fail Always - 1063
2 Throughput_Performance 0x0026 252 252 000 Old_age Always - 0
3 Spin_Up_Time 0x0023 061 044 025 Pre-fail Always - 12000
4 Start_Stop_Count 0x0032 097 097 000 Old_age Always - 3935
5 Reallocated_Sector_Ct 0x0033 252 252 010 Pre-fail Always - 0
7 Seek_Error_Rate 0x002e 252 252 051 Old_age Always - 0
8 Seek_Time_Performance 0x0024 252 252 015 Old_age Offline - 0
9 Power_On_Hours 0x0032 100 100 000 Old_age Always - 10728
10 Spin_Retry_Count 0x0032 252 252 051 Old_age Always - 0
11 Calibration_Retry_Count 0x0032 252 252 000 Old_age Always - 0
12 Power_Cycle_Count 0x0032 097 097 000 Old_age Always - 3918
181 Program_Fail_Cnt_Total 0x0022 099 099 000 Old_age Always - 30835999
191 G-Sense_Error_Rate 0x0022 100 100 000 Old_age Always - 161
192 Power-Off_Retract_Count 0x0022 252 252 000 Old_age Always - 0
194 Temperature_Celsius 0x0002 059 044 000 Old_age Always - 41 (Min/Max 11/58)
195 Hardware_ECC_Recovered 0x003a 100 100 000 Old_age Always - 0
196 Reallocated_Event_Count 0x0032 252 252 000 Old_age Always - 0
197 Current_Pending_Sector 0x0032 100 100 000 Old_age Always - 6
198 Offline_Uncorrectable 0x0030 252 252 000 Old_age Offline - 0
199 UDMA_CRC_Error_Count 0x0036 100 100 000 Old_age Always - 14
200 Multi_Zone_Error_Rate 0x002a 100 100 000 Old_age Always - 37
223 Load_Retry_Count 0x0032 252 252 000 Old_age Always - 0
225 Load_Cycle_Count 0x0032 090 090 000 Old_age Always - 111034
特别是这些结果:
5 Reallocated_Sector_Ct 0x0033 252 252 010 Pre-fail Always - 0
196 Reallocated_Event_Count 0x0032 252 252 000 Old_age Always - 0
197 Current_Pending_Sector 0x0032 100 100 000 Old_age Always - 6
这是否意味着虽然有 6 个坏扇区等待替换,但其他扇区从未被替换过?有没有办法告诉 HDD 替换坏扇区?我可以定义“未使用的扇区”,以便 HDD 可以使用它们来替换坏扇区吗?或者我不应该费心让这个 HDD 的使用寿命更长?
我已按照@heynnema 描述的推荐步骤完成,结果如下:
sudo e2fsck -fccky /dev/sdb1
e2fsck 1.42.13 (17-May-2015)
Checking for bad blocks (non-destructive read-write test)
Testing with random pattern: done
test: Updating bad block inode.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
test: ***** FILE SYSTEM WAS MODIFIED *****
test: 11/122101760 files (0.0% non-contiguous), 7713426/488378390 blocks
答案1
测试磁盘是否有坏块,并绘制出发现的任何坏块...
Note: do NOT abort a bad block scan!
Note: do NOT bad block a SSD
Note: backup your important files FIRST!
sudo e2fsck -fcky /dev/sdXX
# 只读测试
或者
sudo e2fsck -fccky /dev/sdXX
# 非破坏性读写测试(受到推崇的)
-k 很重要,因为它会保存之前的坏块表,并将任何新的坏块添加到该表中。如果没有 -k,您将丢失所有之前的坏块信息。
-fccky 参数...
-f Force checking even if the file system seems clean.
-c This option causes e2fsck to use badblocks(8) program to do a
read-only scan of the device in order to find any bad blocks.
If any bad blocks are found, they are added to the bad block
inode to prevent them from being allocated to a file or direc‐
tory. If this option is specified twice, then the bad block
scan will be done using a non-destructive read-write test.
-k When combined with the -c option, any existing bad blocks in the
bad blocks list are preserved, and any new bad blocks found by
running badblocks(8) will be added to the existing bad blocks
list.
-y Assume an answer of `yes' to all questions; allows e2fsck to be
used non-interactively. This option may not be specified at the
same time as the -n or -p options.