我注意到在使用 传输大量小文件(例如数十万张图片)到外部硬盘时会出现一个奇怪的现象rsync
:它总是导致 IO 错误,如下所示( 的输出dmesg
):
[102560.315796] blk_update_request: I/O error, dev sdc, sector 2088 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[102560.315800] Buffer I/O error on dev sdc1, logical block 5, async page read
[102560.315868] blk_update_request: I/O error, dev sdc, sector 2184 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[102560.315870] Buffer I/O error on dev sdc1, logical block 17, async page read
[102560.315877] blk_update_request: I/O error, dev sdc, sector 2120 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[102560.315878] Buffer I/O error on dev sdc1, logical block 9, async page read
[102560.315935] blk_update_request: I/O error, dev sdc, sector 2088 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[102560.315936] Buffer I/O error on dev sdc1, logical block 5, async page read
[102560.315944] Buffer I/O error on dev sdc1, logical block 5, async page read
[102560.315956] Buffer I/O error on dev sdc1, logical block 17, async page read
[102560.315965] Buffer I/O error on dev sdc1, logical block 5, async page read
[102560.315972] Buffer I/O error on dev sdc1, logical block 5, async page read
[102560.315979] Buffer I/O error on dev sdc1, logical block 5, async page read
然后 HDD 就无法安装,但是每次发生这种情况时我都可以使用它来修复它,ntfsfix
所以我怀疑这是一个硬件问题。ntfsfix
输出显示如下:
Mounting volume... $MFTMirr does not match $MFT (record 0).
FAILED
Attempting to correct errors...
Processing $MFT and $MFTMirr...
Reading $MFT... OK
Reading $MFTMirr... OK
Comparing $MFTMirr to $MFT... FAILED
Correcting differences in $MFTMirr record 0...OK
Processing of $MFT and $MFTMirr completed successfully.
Setting required flags on partition... OK
Going to empty the journal ($LogFile)... OK
Checking the alternate boot sector... OK
NTFS volume version is 3.1.
NTFS partition /dev/sdc1 was processed successfully.
所以我真的很好奇,是什么原因导致硬盘损坏如此频繁,即使是最基本的文件 IO 操作也是如此。在过去两天里,硬盘损坏已经发生了 20 多次。是系统问题,还是rsync
磁盘本身问题?
另一个奇怪的现象:在 rsync 大量文件之后,即使没有发生 IO 错误,卸载磁盘也需要很长时间(约 10 分钟)。
我正在使用 Ubuntu 20.04,HDD 是 Seagate SDC003(2TB,格式化为 NTFS)。
更新:的输出smartctl -a
。我在又一次rsync
失败后立即运行了这个。
smartctl 7.1 2019-12-30 r5022 [x86_64-linux-5.15.0-69-generic] (local build)
Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Model Family: Seagate Barracuda 2.5 5400
Device Model: ST2000LM015-2E8174
Serial Number: WDZXFWCV
LU WWN Device Id: 5 000c50 0e08ae450
Firmware Version: 0001
User Capacity: 2,000,398,934,016 bytes [2.00 TB]
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: ACS-3 T13/2161-D revision 3b
SATA Version is: SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is: Fri Jun 16 16:28:00 2023 CST
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: ( 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: (0x71) SMART execute Offline immediate.
No Auto Offline data collection 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: ( 326) minutes.
Conveyance self-test routine
recommended polling time: ( 2) minutes.
SCT capabilities: (0x3035) 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 075 064 006 Pre-fail Always - 30523320
3 Spin_Up_Time 0x0003 099 099 000 Pre-fail Always - 0
4 Start_Stop_Count 0x0032 100 100 020 Old_age Always - 449
5 Reallocated_Sector_Ct 0x0033 100 100 036 Pre-fail Always - 0
7 Seek_Error_Rate 0x000f 071 060 045 Pre-fail Always - 13036046
9 Power_On_Hours 0x0032 094 094 000 Old_age Always - 6120 (197 141 0)
10 Spin_Retry_Count 0x0013 100 100 097 Pre-fail Always - 0
12 Power_Cycle_Count 0x0032 100 100 020 Old_age Always - 90
184 End-to-End_Error 0x0032 100 100 099 Old_age Always - 0
187 Reported_Uncorrect 0x0032 100 100 000 Old_age Always - 0
188 Command_Timeout 0x0032 100 100 000 Old_age Always - 0
189 High_Fly_Writes 0x003a 100 100 000 Old_age Always - 0
190 Airflow_Temperature_Cel 0x0022 052 047 040 Old_age Always - 48 (Min/Max 47/48)
191 G-Sense_Error_Rate 0x0032 100 100 000 Old_age Always - 11
192 Power-Off_Retract_Count 0x0032 100 100 000 Old_age Always - 32
193 Load_Cycle_Count 0x0032 100 100 000 Old_age Always - 1715
194 Temperature_Celsius 0x0022 048 053 000 Old_age Always - 48 (0 13 0 0 0)
197 Current_Pending_Sector 0x0012 100 100 000 Old_age Always - 0
198 Offline_Uncorrectable 0x0010 100 100 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 - 175 (86 165 0)
241 Total_LBAs_Written 0x0000 100 253 000 Old_age Offline - 5808417042
242 Total_LBAs_Read 0x0000 100 253 000 Old_age Offline - 1793836935
254 Free_Fall_Sensor 0x0032 100 100 000 Old_age Always - 0
SMART Error Log Version: 1
No Errors Logged
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.