最近我发现我的硬盘经常会停止旋转。据我所知,这是一种新现象。我担心频繁的停止旋转/启动旋转序列会损坏硬件(会发生这种情况吗?)。我正在运行 linux 5.15.8-1-default,并尝试使用 hdparm 更改省电选项 - 这是我在互联网上找到的唯一解决方案:
hdparm -S 255 /dev/sda
/dev/sda:
setting standby to 255 (21 minutes + 15 seconds)
和
hdparm -B 255 /dev/sda
/dev/sda:
setting Advanced Power Management level to disabled
APM_level = off
尽管如此,硬盘经常在几秒钟后就停止旋转,例如:
dmesg -T |grep sda
[So Jan 2 09:31:39 2022] sd 0:0:0:0: [sda] 1953525168 512-byte logical blocks: (1.00 TB/932 GiB)
[So Jan 2 09:31:39 2022] sd 0:0:0:0: [sda] 4096-byte physical blocks
[So Jan 2 09:31:39 2022] sd 0:0:0:0: [sda] Write Protect is off
[So Jan 2 09:31:39 2022] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
[So Jan 2 09:31:39 2022] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[So Jan 2 09:31:39 2022] sda: sda1 sda2 sda3 sda4 sda5
[So Jan 2 09:31:39 2022] sd 0:0:0:0: [sda] Attached SCSI disk
[So Jan 2 09:31:45 2022] EXT4-fs (sda4): recovery complete
[So Jan 2 09:31:45 2022] EXT4-fs (sda4): mounted filesystem with ordered data mode. Opts: (null). Quota mode: none.
[So Jan 2 09:37:59 2022] sd 0:0:0:0: [sda] Synchronizing SCSI cache
[So Jan 2 09:37:59 2022] sd 0:0:0:0: [sda] Stopping disk
[So Jan 2 09:38:02 2022] sd 0:0:0:0: [sda] Starting disk
[So Jan 2 09:42:59 2022] sd 0:0:0:0: [sda] Synchronizing SCSI cache
[So Jan 2 09:42:59 2022] sd 0:0:0:0: [sda] Stopping disk
[So Jan 2 09:52:00 2022] sd 0:0:0:0: [sda] Starting disk
[So Jan 2 09:52:35 2022] sd 0:0:0:0: [sda] Synchronizing SCSI cache
[So Jan 2 09:52:35 2022] sd 0:0:0:0: [sda] Stopping disk
[So Jan 2 09:53:01 2022] sd 0:0:0:0: [sda] Starting disk
[So Jan 2 09:53:38 2022] sd 0:0:0:0: [sda] Synchronizing SCSI cache
[So Jan 2 09:53:38 2022] sd 0:0:0:0: [sda] Stopping disk
[So Jan 2 10:01:54 2022] sd 0:0:0:0: [sda] Starting disk
[So Jan 2 10:02:18 2022] sd 0:0:0:0: [sda] Synchronizing SCSI cache
[So Jan 2 10:02:18 2022] sd 0:0:0:0: [sda] Stopping disk
[So Jan 2 10:12:00 2022] sd 0:0:0:0: [sda] Starting disk
[So Jan 2 10:12:20 2022] sd 0:0:0:0: [sda] Synchronizing SCSI cache
[So Jan 2 10:12:20 2022] sd 0:0:0:0: [sda] Stopping disk
在发出 hdparm 命令和 dmesg 之间不重新启动。我知道这个话题经常被讨论,但通常人们使用 hdparm 都能成功,我无法找出为什么过去没有发生这种情况。所以我的问题是:
反复旋转减速和加速真的会损害硬件吗?
行为的改变是否可能来自 a) 软件更新或 b) 硬件老化?
有没有我没找到的解决方案?如何让驱动器保持更长时间?
过去我已经发现一些设备确实忽略了 hdparm 设置,但真正奇怪的是,这个驱动器或我的系统现在改变了它的行为。感谢您的帮助!
答案1
该问题由 tlp.service 造成,因为它在 BAT 上启用了 ALPM(AHCI 链路电源管理)和 AHCI Runtime PM,从而导致 hdd/ssd 的启动/停止/启动/停止。
要禁用:在 /etc/tlp.conf(或旧版本的 /etc/default/tlp.conf)中,取消注释:
SATA_LINKPWR_DENYLIST="hostX"
参考 tlp-stat -d 的输出来确定主机,相应地替换“X”。取消注释并设置为“on”(表示“禁用”)
AHCI_RUNTIME_PM_ON_BAT=on
您必须关闭电源再关闭电源才能使设置生效 - 而不仅仅是重置!
使用 powertop 进行验证 - “可调整设置”选项卡应显示:
bad Runtime PM for disk sda
bad Runtime PM for port ata1 of PCI device: [your specific vendor device e.g. Intel Atom/Celeron/Pentium Processor N3XXX Series]
bad Runtime PM for port ata2 of PCI device: [your specific vendor device e.g. Intel Atom/Celeron/Pentium Processor N3XXX Series]
查看“journalctl -f”来监控。