我遇到了一个问题,硬盘在写入数据完成后发出很大的活动噪音。
我正在运行 Linux。
例如,如果我复制一个文件(60GB),那么一旦复制完成,驱动器就会开始发出类似于系统频繁交换时听到的声音。这种情况可能会持续几分钟。
问题是,它根本没有交换,我甚至尝试完全禁用交换,所以这是排除的。
iotop
没有显示任何活动。
echo 1 >/proc/sys/vm/block_dump
也没有显示任何活动。
因此这似乎发生在操作系统范围之外。
如果在此期间我尝试读取或复制另一个文件,那么驱动器将停止这种大声活动,并全速执行我要求它执行的操作(性能不会下降),一旦它空闲,它将再次恢复执行该大声活动,因此这仅当驱动器本身空闲时才会发生,读/写性能不会中断。
我已经检查过 SMART 并且它看起来没什么问题:
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.10.0-12-amd64] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Model Family: Toshiba 2.5" HDD MQ01ABD...
Device Model: TOSHIBA MQ01ABD075
Firmware Version: AX0A4M
User Capacity: 750,156,374,016 bytes [750 GB]
Sector Size: 512 bytes logical/physical
Rotation Rate: 5400 rpm
Form Factor: 2.5 inches
Device is: In smartctl database [for details use: -P show]
ATA Version is: ATA8-ACS (minor revision not indicated)
SATA Version is: SATA 2.6, 3.0 Gb/s (current: 3.0 Gb/s)
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: ( 120) 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: ( 2) minutes.
Extended self-test routine
recommended polling time: ( 189) minutes.
SCT capabilities: (0x003d) SCT Status supported.
SCT Error Recovery Control supported.
SCT Feature Control supported.
SCT Data Table supported.
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 050 Pre-fail Always - 0
2 Throughput_Performance 0x0005 100 100 050 Pre-fail Offline - 0
3 Spin_Up_Time 0x0027 100 100 001 Pre-fail Always - 1699
4 Start_Stop_Count 0x0032 100 100 000 Old_age Always - 3423
5 Reallocated_Sector_Ct 0x0033 100 100 050 Pre-fail Always - 0
7 Seek_Error_Rate 0x000b 100 100 050 Pre-fail Always - 0
8 Seek_Time_Performance 0x0005 100 100 050 Pre-fail Offline - 0
9 Power_On_Hours 0x0032 077 077 000 Old_age Always - 9338
10 Spin_Retry_Count 0x0033 168 100 030 Pre-fail Always - 0
12 Power_Cycle_Count 0x0032 100 100 000 Old_age Always - 3381
191 G-Sense_Error_Rate 0x0032 100 100 000 Old_age Always - 779
192 Power-Off_Retract_Count 0x0032 100 100 000 Old_age Always - 308
193 Load_Cycle_Count 0x0032 098 098 000 Old_age Always - 26548
194 Temperature_Celsius 0x0022 100 100 000 Old_age Always - 32 (Min/Max 6/52)
196 Reallocated_Event_Count 0x0032 100 100 000 Old_age Always - 0
197 Current_Pending_Sector 0x0032 100 100 000 Old_age Always - 0
198 Offline_Uncorrectable 0x0030 100 100 000 Old_age Offline - 0
199 UDMA_CRC_Error_Count 0x0032 200 200 000 Old_age Always - 0
220 Disk_Shift 0x0002 100 100 000 Old_age Always - 0
222 Loaded_Hours 0x0032 083 083 000 Old_age Always - 7039
223 Load_Retry_Count 0x0032 100 100 000 Old_age Always - 0
224 Load_Friction 0x0022 100 100 000 Old_age Always - 0
226 Load-in_Time 0x0026 100 100 000 Old_age Always - 272
240 Head_Flying_Hours 0x0001 100 100 001 Pre-fail Offline - 0
SMART Error Log Version: 1
No Errors Logged
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% 9223 -
# 2 Short offline Completed without error 00% 9221 -
# 3 Extended offline Completed without error 00% 8968 -
# 4 Short offline Completed without error 00% 8965 -
# 5 Short offline Completed without error 00% 8965 -
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.
dmesg
:
[ 4.558633] SCSI subsystem initialized
[ 4.570269] libata version 3.00 loaded.
[ 4.573616] ahci 0000:00:17.0: version 3.0
[ 4.573861] ahci 0000:00:17.0: AHCI 0001.0301 32 slots 1 ports 6 Gbps 0x1 impl SATA mode
[ 4.573863] ahci 0000:00:17.0: flags: 64bit ncq pm led clo only pio slum part deso sadm sds apst
[ 4.574130] scsi host0: ahci
[ 4.574275] ata1: SATA max UDMA/133 abar m2048@0xf0136000 port 0xf0136100 irq 123
[ 4.890860] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
[ 4.891775] ata1.00: ACPI cmd f5/00:00:00:00:00:e0 (SECURITY FREEZE LOCK) filtered out
[ 4.891781] ata1.00: ACPI cmd b1/c1:00:00:00:00:e0 (DEVICE CONFIGURATION OVERLAY) filtered out
[ 4.925670] ata1.00: ATA-8: TOSHIBA MQ01ABD075, AX0A4M, max UDMA/100
[ 4.925677] ata1.00: 1465149168 sectors, multi 16: LBA48 NCQ (depth 32), AA
[ 4.927217] ata1.00: ACPI cmd f5/00:00:00:00:00:e0 (SECURITY FREEZE LOCK) filtered out
[ 4.927225] ata1.00: ACPI cmd b1/c1:00:00:00:00:e0 (DEVICE CONFIGURATION OVERLAY) filtered out
[ 4.928204] ata1.00: configured for UDMA/100
[ 4.929113] scsi 0:0:0:0: Direct-Access ATA TOSHIBA MQ01ABD0 4M PQ: 0 ANSI: 5
[ 4.947364] sd 0:0:0:0: [sda] 1465149168 512-byte logical blocks: (750 GB/699 GiB)
[ 4.947415] sd 0:0:0:0: [sda] Write Protect is off
[ 4.947423] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
[ 4.947473] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[ 5.098647] sda: sda1 sda2 sda3 sda4 sda5 sda6 sda7 sda8 sda9 sda10
[ 5.115598] sd 0:0:0:0: [sda] Attached SCSI disk
这是否与某些驱动器功能有关,当它不执行任何操作时,它会在内部重新排列数据,以加快读取访问性能,或类似的东西?
是否可以禁用(或调整)此行为,例如用于hdparm
禁用 APM?
我尝试禁用 NCQ,但没有帮助,在 AHCI 标志下还有其他东西:
[ 4.573863] ahci 0000:00:17.0: flags: 64bit ncq pm led clo only pio slum part deso sadm sds apst
这确实让我抓狂,尽管它没有发生任何性能损失。
我有其他硬盘,它们的行为不会那样,一旦传输结束(并同步),驱动器将保持完全静音。
这仅在写入操作之后才会发生。
使用以下方式读取 60GB:
# dd if=/dev/sda8 of=/dev/null bs=10M status=progress
64424509440 bytes (64 GB, 60 GiB) copied, 640 s, 101 MB/s
磁盘保持安静。
使用以下方式写入 60GB:
# dd if=/dev/sda8 of=/dev/sda9 bs=10M status=progress; sync
64424509440 bytes (64 GB, 60 GiB) copied, 1316.57 s, 48.9 MB/s
一旦sync
完成后,磁盘开始发出非常响的声音(像震动一样的声音),持续约 2 分 30 秒。
交换已关闭。
持续时间取决于写入的数据量,因此写入 10GB 后通常会在 20 秒内完成,写入 20GB 后会在 50-60 秒内完成,写入 60GB 后会在 150-180 秒内完成。
这可能与一些写入后的额外数据完整性检查有关,但仍然应该有办法对其进行调整。