当我使用 dd 工具将驱动器“归零”时,出现此输入/输出错误:
我的驱动器是否适合用于垃圾处理?或者有没有什么办法可以修复它?
非常感谢您的回答:)
sudo dd if=/dev/zero of=/dev/zero bs=4096 status=progress
它与 一起工作bs=4096
!
sudo badblocks -wsv /dev/sda
读写坏块测试正常。
Pass completed, 0 bad blocks found (0/0/0 errors)
sudo smartctl -H /dev/sda
快速报告OK(已通过):
smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.18.0-15-generic] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke,
www.smartmontools.org
=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
我进行了这个测试:
sudo smartctl -t long /dev/sda
以下是获得的报告:
sudo smartctl -a /dev/sda
smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.18.0-15-generic] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Device Model: Hitachi HDS721050CLA360
Serial Number: JP1572FN3RJ3WK LU WWN
Device Id: 5 000cca 399f48335
Firmware Version: JP2OA50E
User Capacity: 500,107,862,016 bytes [500 GB]
Sector Size: 512 bytes logical/physical
Rotation Rate: 7200 rpm
Form Factor: 3.5 inches
Device is: Not in smartctl database [for details use: -P showall]
ATA Version is: ATA8-ACS T13/1699-D revision 4
SATA Version is: SATA 2.6, 3.0 Gb/s
Local Time is: Tue Nov 26 16:03:40 2019 UTC
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: (0x80)
Offline data collection activity was never started.
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: ( 4920) seconds.
Offline data collection capabilities: (0x5b) SMART execute Offline immediate.
Auto Offline data collection on/off support.
Suspend Offline collection upon new
command.
Offline surface scan supported.
Self-test supported.
No 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: ( 82) minutes.
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 0x000b 100 100 016 Pre-fail Always - 0
2 Throughput_Performance 0x0005 136 136 054 Pre-fail Offline - 95
3 Spin_Up_Time 0x0007 118 118 024 Pre-fail Always - 193 (Average 195)
4 Start_Stop_Count 0x0012 100 100 000 Old_age Always - 1533
5 Reallocated_Sector_Ct 0x0033 100 100 005 Pre-fail Always - 0
7 Seek_Error_Rate 0x000b 100 100 067 Pre-fail Always - 0
8 Seek_Time_Performance 0x0005 140 140 020 Pre-fail Offline - 30
9 Power_On_Hours 0x0012 099 099 000 Old_age Always - 11208
10 Spin_Retry_Count 0x0013 100 100 060 Pre-fail Always - 0
12 Power_Cycle_Count 0x0032 100 100 000 Old_age Always - 1533
192 Power-Off_Retract_Count 0x0032 099 099 000 Old_age Always - 1533
193 Load_Cycle_Count 0x0012 099 099 000 Old_age Always - 1533
194 Temperature_Celsius 0x0002 222 222 000 Old_age Always - 27 (Min/Max 10/34)
196 Reallocated_Event_Count 0x0032 100 100 000 Old_age Always - 0
197 Current_Pending_Sector 0x0022 100 100 000 Old_age Always - 0 198 Offline_Uncorrectable 0x0008 100 100 000 Old_age Offline - 0
199 UDMA_CRC_Error_Count 0x000a 200 200 000 Old_age Always - 0
SMART Error Log Version: 1
ATA Error Count: 88 (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 88 occurred at disk power-on lifetime: 11195 hours (466 days + 11 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 51 05 0b e4 5b 03
Error: UNC at LBA = 0x035be40b = 56353803
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 08 30 08 e4 5b 40 00 13d+15:30:26.073 READ FPDMA QUEUED
60 08 28 00 e4 5b 40 00 13d+15:30:26.072 READ FPDMA QUEUED
60 08 20 f8 e3 5b 40 00 13d+15:30:26.071 READ FPDMA QUEUED
60 08 18 f0 e3 5b 40 00 13d+15:30:26.070 READ FPDMA QUEUED
60 08 10 e8 e3 5b 40 00 13d+15:30:26.069 READ FPDMA QUEUED
Error 87 occurred at disk power-on lifetime: 11194 hours (466 days + 10 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 51 05 0b e4 5b 03
Error: UNC at LBA = 0x035be40b = 56353803
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 08 c0 08 e4 5b 40 00 13d+09:23:07.021 READ FPDMA QUEUED
60 08 b8 00 e4 5b 40 00 13d+09:23:07.019 READ FPDMA QUEUED
60 08 b0 f8 e3 5b 40 00 13d+09:23:07.018 READ FPDMA QUEUED
60 08 a8 f0 e3 5b 40 00 13d+09:23:07.017 READ FPDMA QUEUED
60 08 a0 e8 e3 5b 40 00 13d+09:23:07.015 READ FPDMA QUEUED
Error 86 occurred at disk power-on lifetime: 11189 hours (466 days + 5 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 51 05 0b e4 5b 03
Error: UNC at LBA = 0x035be40b = 56353803
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 08 c0 08 e4 5b 40 00 12d+03:26:04.624 READ FPDMA QUEUED
60 08 b8 00 e4 5b 40 00 12d+03:26:04.624 READ FPDMA QUEUED
60 08 b0 f8 e3 5b 40 00 12d+03:26:04.623 READ FPDMA QUEUED
60 08 a8 f0 e3 5b 40 00 12d+03:26:04.622 READ FPDMA QUEUED
60 08 a0 e8 e3 5b 40 00 12d+03:26:04.621 READ FPDMA QUEUED
Error 85 occurred at disk power-on lifetime: 10943 hours (455 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 51 0d 0b e4 5b 03
Error: UNC at LBA = 0x035be40b = 56353803
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 20 18 00 58 44 40 00 48d+23:49:04.673 READ FPDMA QUEUED
60 08 10 30 e5 5b 40 00 48d+23:49:04.673 READ FPDMA QUEUED
60 10 08 08 e4 5b 40 00 48d+23:49:04.673 READ FPDMA QUEUED
ef 02 00 00 00 00 00 00 48d+23:49:04.671 SET FEATURES [Enable write cache]
60 20 18 00 58 44 a0 ff 48d+23:49:04.554 READ FPDMA QUEUED
Error 84 occurred at disk power-on lifetime: 10943 hours (455 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 51 0d 0b e4 5b 03
Error: UNC at LBA = 0x035be40b = 56353803
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 20 18 00 58 44 40 00 48d+23:48:46.106 READ FPDMA QUEUED
60 08 10 30 e5 5b 40 00 48d+23:48:46.106 READ FPDMA QUEUED
60 10 08 08 e4 5b 40 00 48d+23:48:46.105 READ FPDMA QUEUED
ef 02 00 00 00 00 00 00 48d+23:48:46.104 SET FEATURES [Enable write cache]
60 20 18 00 58 44 a0 ff 48d+23:48:45.990 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 without error 00% 11208 -
\# 2 Short offline Completed without error 00% 11206 -
\# 3 Short offline Completed without error 00% 11206 -
\# 4 Vendor (0x50) Completed without error 00% 0 -
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.
完成所有这些后,我尝试使用默认 bs 值的另一个 dd,以确保万无一失:
sudo dd if=/dev/zero of=/dev/zero status=progress
目前,dd
已写入 78 GB,没有任何错误,并且继续...
你知道发生什么事了吗?
谢谢 :)
答案1
我也遇到过坏块的问题。驱动器的扇区大小可能是 512 字节,但块大小是 4096 字节,这是磁盘 I/O 可用的最小大小(例如,参见 的输出blockdev --report
)。dd
使用默认大小(512)写入驱动器的健康区域是没问题的,但如果出现问题,则需要写入整个块(bs=4096
)。
这回答给出的理由是:如果要只写入一个块的一个扇区,必须先读取整个块,然后更改扇区数据并写回块。在我们的例子中,读取失败,因此在 bs=512 的情况下整个操作失败。但是,在 bs=4096 的情况下,不需要读取,因为整个块将被替换;因此操作成功。
dd
使用将零写入驱动器的想法是强制驱动器固件确认每个扇区的健康状况并将任何坏扇区重新映射到保留区域。一旦成功写入坏块(然后由驱动器确认健康或重新映射),该badblocks
工具(这是一个更高级别的工具)就会很开心,因为坏块被隐藏了,并且 smartctl 测试也通过了。