为何我的非系统硬盘无法减速?

为何我的非系统硬盘无法减速?

不幸的是,我的非系统(/媒体)硬盘在大约 1-2 分钟后从睡眠状态唤醒。我尝试借助以下线程调查哪个进程可以在睡眠期间请求访问硬盘:

https://unix.stackexchange.com/questions/29409/finding-out-what-is-spinning-up-harddrive

结果: root@xyz:/# dmesg -c | grep sdb [158741.703982] systemd-udevd(22709): READ block 5860530048 on sdb1 (8 sectors) [158748.094970] systemd-udevd(22709): READ block 5860530160 on sdb1 (8 sectors) [158748.107881] systemd-udevd(22709): READ block 0 on sdb1 (8 sectors) [158748.107974] systemd-udevd(22709): READ block 8 on sdb1 (8 sectors) [158748.108050] systemd-udevd(22709): READ block 5860530168 on sdb1 (8 sectors) [158748.108118] systemd-udevd(22709): READ block 5860529912 on sdb1 (8 sectors) [158748.108243] systemd-udevd(22709): READ block 24 on sdb1 (8 sectors) [158748.108306] systemd-udevd(22709): READ block 56 on sdb1 (8 sectors) [158748.108424] systemd-udevd(22709): READ block 0 on sdb (8 sectors) [158748.108510] systemd-udevd(22709): READ block 8 on sdb (8 sectors) [158748.108515] systemd-udevd(22709): READ block 16 on sdb (8 sectors) [158748.108519] systemd-udevd(22709): READ block 24 on sdb (8 sectors) [158748.108522] systemd-udevd(22709): READ block 32 on sdb (8 sectors) [158748.109663] parted(22708): READ block 5860533160 on sdb (8 sectors) [158748.111845] parted(22708): READ block 5860533128 on sdb (8 sectors) [158748.111857] parted(22708): READ block 5860533136 on sdb (8 sectors) [158748.111861] parted(22708): READ block 5860533144 on sdb (8 sectors) [158748.111864] parted(22708): READ block 5860533152 on sdb (8 sectors) [158748.112577] parted(22708): READ block 2304 on sdb (8 sectors) [158748.112655] parted(22708): READ block 2176 on sdb (8 sectors) [158748.112724] parted(22708): READ block 2048 on sdb (8 sectors) [158748.112792] parted(22708): READ block 5860532216 on sdb (8 sectors) [158748.112873] parted(22708): READ block 2112 on sdb (8 sectors) [158748.112973] parted(22708): READ block 2064 on sdb (8 sectors) [158748.113039] parted(22708): READ block 2560 on sdb (8 sectors) [158748.114847] systemd-udevd(22718): READ block 5860532992 on sdb (8 sectors) [158748.115923] systemd-udevd(22718): READ block 5860532904 on sdb (8 sectors) [158748.116003] systemd-udevd(22718): READ block 5860533104 on sdb (8 sectors) [158748.116063] systemd-udevd(22718): READ block 5860532912 on sdb (8 sectors) [158748.116123] systemd-udevd(22718): READ block 5860532768 on sdb (8 sectors) [158748.116180] systemd-udevd(22718): READ block 5860532576 on sdb (8 sectors) [158748.116236] systemd-udevd(22718): READ block 5860532488 on sdb (8 sectors) [158748.116290] systemd-udevd(22718): READ block 5860532432 on sdb (8 sectors) [158748.116345] systemd-udevd(22718): READ block 5860532256 on sdb (8 sectors) [158748.116403] systemd-udevd(22718): READ block 5860532192 on sdb (8 sectors) [158748.116453] systemd-udevd(22718): READ block 5860532176 on sdb (8 sectors) [158748.116507] systemd-udevd(22718): READ block 5860530080 on sdb (8 sectors) [158748.136347] systemd-udevd(22718): READ block 56 on sdb (8 sectors) [158748.136517] systemd-udevd(22718): READ block 120 on sdb (8 sectors) [158748.136734] systemd-udevd(22718): READ block 40 on sdb (8 sectors) [158748.136746] systemd-udevd(22718): READ block 48 on sdb (8 sectors) [158748.136762] systemd-udevd(22718): READ block 64 on sdb (8 sectors) [158748.136766] systemd-udevd(22718): READ block 72 on sdb (8 sectors) [158748.136770] systemd-udevd(22718): READ block 80 on sdb (8 sectors) [158748.136773] systemd-udevd(22718): READ block 88 on sdb (8 sectors) [158748.136778] systemd-udevd(22718): READ block 96 on sdb (8 sectors) [158748.136781] systemd-udevd(22718): READ block 104 on sdb (8 sectors) [158748.136784] systemd-udevd(22718): READ block 112 on sdb (8 sectors) [158748.136787] systemd-udevd(22718): READ block 128 on sdb (8 sectors) [158748.136792] systemd-udevd(22718): READ block 136 on sdb (8 sectors) [158748.136795] systemd-udevd(22718): READ block 144 on sdb (8 sectors) [158748.136798] systemd-udevd(22718): READ block 152 on sdb (8 sectors) [158748.136801] systemd-udevd(22718): READ block 160 on sdb (8 sectors) [158748.136804] systemd-udevd(22718): READ block 168 on sdb (8 sectors) [158748.136808] systemd-udevd(22718): READ block 176 on sdb (8 sectors) [158748.136814] systemd-udevd(22718): READ block 184 on sdb (8 sectors) [158748.136817] systemd-udevd(22718): READ block 192 on sdb (8 sectors) [158748.136820] systemd-udevd(22718): READ block 200 on sdb (8 sectors) [158748.136826] systemd-udevd(22718): READ block 208 on sdb (8 sectors) [158748.136829] systemd-udevd(22718): READ block 216 on sdb (8 sectors) [158748.136836] systemd-udevd(22718): READ block 224 on sdb (8 sectors) [158748.136841] systemd-udevd(22718): READ block 232 on sdb (8 sectors) [158748.136845] systemd-udevd(22718): READ block 240 on sdb (8 sectors) [158748.136848] systemd-udevd(22718): READ block 248 on sdb (8 sectors) [158748.136852] systemd-udevd(22718): READ block 256 on sdb (8 sectors) [158748.136858] systemd-udevd(22718): READ block 264 on sdb (8 sectors) [158748.136862] systemd-udevd(22718): READ block 272 on sdb (8 sectors) [158748.136865] systemd-udevd(22718): READ block 280 on sdb (8 sectors) [158748.136868] systemd-udevd(22718): READ block 288 on sdb (8 sectors) [158748.136874] systemd-udevd(22718): READ block 296 on sdb (8 sectors) [158748.136878] systemd-udevd(22718): READ block 304 on sdb (8 sectors) [158748.136882] systemd-udevd(22718): READ block 312 on sdb (8 sectors) [158748.136885] systemd-udevd(22718): READ block 320 on sdb (8 sectors) [158748.136887] systemd-udevd(22718): READ block 328 on sdb (8 sectors) [158748.136895] systemd-udevd(22718): READ block 336 on sdb (8 sectors) [158748.136899] systemd-udevd(22718): READ block 344 on sdb (8 sectors) [158748.136903] systemd-udevd(22718): READ block 352 on sdb (8 sectors) [158748.136907] systemd-udevd(22718): READ block 360 on sdb (8 sectors) [158748.136911] systemd-udevd(22718): READ block 368 on sdb (8 sectors) [158748.136914] systemd-udevd(22718): READ block 376 on sdb (8 sectors) [158748.136917] systemd-udevd(22718): READ block 384 on sdb (8 sectors) [158748.136923] systemd-udevd(22718): READ block 392 on sdb (8 sectors) [158748.136927] systemd-udevd(22718): READ block 400 on sdb (8 sectors) [158748.136932] systemd-udevd(22718): READ block 408 on sdb (8 sectors) [158748.136936] systemd-udevd(22718): READ block 416 on sdb (8 sectors) [158748.136939] systemd-udevd(22718): READ block 424 on sdb (8 sectors) [158748.136943] systemd-udevd(22718): READ block 432 on sdb (8 sectors) [158748.136945] systemd-udevd(22718): READ block 440 on sdb (8 sectors) [158748.136949] systemd-udevd(22718): READ block 448 on sdb (8 sectors) [158748.136952] systemd-udevd(22718): READ block 456 on sdb (8 sectors) [158748.136954] systemd-udevd(22718): READ block 464 on sdb (8 sectors) [158748.136956] systemd-udevd(22718): READ block 472 on sdb (8 sectors) [158748.136959] systemd-udevd(22718): READ block 480 on sdb (8 sectors) [158748.136961] systemd-udevd(22718): READ block 488 on sdb (8 sectors) [158748.136965] systemd-udevd(22718): READ block 496 on sdb (8 sectors) [158748.136968] systemd-udevd(22718): READ block 504 on sdb (8 sectors) [158748.138198] systemd-udevd(22718): READ block 768 on sdb (8 sectors) [158748.138303] systemd-udevd(22718): READ block 776 on sdb (8 sectors) [158748.138363] systemd-udevd(22718): READ block 784 on sdb (8 sectors) [158748.138445] systemd-udevd(22718): READ block 792 on sdb (8 sectors) [158748.138540] systemd-udevd(22718): READ block 800 on sdb (8 sectors) [158748.138629] systemd-udevd(22718): READ block 808 on sdb (8 sectors) [158748.138712] systemd-udevd(22718): READ block 816 on sdb (8 sectors) [158748.138798] systemd-udevd(22718): READ block 824 on sdb (8 sectors) [158748.138927] systemd-udevd(22718): READ block 832 on sdb (8 sectors) [158748.139047] systemd-udevd(22718): READ block 840 on sdb (8 sectors) [158748.139129] systemd-udevd(22718): READ block 848 on sdb (8 sectors) [158748.139220] systemd-udevd(22718): READ block 856 on sdb (8 sectors) [158748.139312] systemd-udevd(22718): READ block 864 on sdb (8 sectors) [158748.139391] systemd-udevd(22718): READ block 872 on sdb (8 sectors) [158748.139470] systemd-udevd(22718): READ block 880 on sdb (8 sectors) [158748.139610] systemd-udevd(22718): READ block 888 on sdb (8 sectors) [158748.139717] systemd-udevd(22718): READ block 896 on sdb (8 sectors) [158748.140240] systemd-udevd(22718): READ block 904 on sdb (8 sectors) [158748.140307] systemd-udevd(22718): READ block 912 on sdb (8 sectors) [158748.140414] systemd-udevd(22718): READ block 920 on sdb (8 sectors) [158748.140480] systemd-udevd(22718): READ block 928 on sdb (8 sectors) [158748.140544] systemd-udevd(22718): READ block 936 on sdb (8 sectors) [158748.140607] systemd-udevd(22718): READ block 944 on sdb (8 sectors) [158748.140664] systemd-udevd(22718): READ block 952 on sdb (8 sectors) [158748.140721] systemd-udevd(22718): READ block 960 on sdb (8 sectors) [158748.140784] systemd-udevd(22718): READ block 968 on sdb (8 sectors) [158748.140845] systemd-udevd(22718): READ block 976 on sdb (8 sectors) [158748.140901] systemd-udevd(22718): READ block 984 on sdb (8 sectors) [158748.140964] systemd-udevd(22718): READ block 992 on sdb (8 sectors) [158748.141025] systemd-udevd(22718): READ block 1000 on sdb (8 sectors) [158748.141157] systemd-udevd(22718): READ block 1008 on sdb (8 sectors) [158748.141221] systemd-udevd(22718): READ block 1016 on sdb (8 sectors) [158748.141289] systemd-udevd(22718): READ block 512 on sdb (8 sectors) [158748.141359] systemd-udevd(22718): READ block 4096 on sdb (8 sectors)

所以首先我试图找出 system-udevd 负责什么。我猜想可能是 SMART 功能唤醒了它。但即使我关闭了智能 (smartctl set -off /dev/sdb),硬盘仍然被唤醒。最后我停止了 udevd 服务,但 parted 进程仍然唤醒了它。而且无论如何,udevd 对系统来说可能是必不可少的。当然,gparted 不在后台运行。我还尝试将 noatime 选项添加到 fstab 中,但没有任何帮助。我的想法已经用尽,在互联网上也找不到任何提示。所以我真的很感激一些有针对性的帮助,以获得解决方案。

大约有几个月我都没有遇到过这个问题,所以我猜想这可能是一个 bug。可能是 udev/parted 进程的问题,或者我不知道。如果您需要更多信息进行调查,我很乐意发布更多信息。请不要卸载硬盘,我希望有一个自动化解决方案,因为它原本打算工作。谢谢!

root@xyz:/# uname -r 3.16.0-33-generic root@xyz:/# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 14.10 Release: 14.10 Codename: utopic

挂载列表:

root@xyz mount -l ... /dev/mapper/sdb1_crypt on /media/vol1 type btrfs (rw,noatime,device=/dev/mapper/sdb1_crypt,device=/dev/mapper/sdc1_crypt,compress=lzo)

root@xyz:/# sudo smartctl -i -d sat /dev/sdb -P show
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.16.0-33-generic] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org
enter code here
Drive found in smartmontools Database.  Drive identity strings:
MODEL:              WDC WD30EFRX-68AX9N0
FIRMWARE:           80.00A80
match smartmontools Drive Database entry:
MODEL REGEXP:       WDC WD(10|20|30)EFRX-.*
FIRMWARE REGEXP:    .*
MODEL FAMILY:       Western Digital Red (AF)
ATTRIBUTE OPTIONS:  None preset; no -v options are required.

答案1

我正在追踪类似的问题,并且正在使用整合查看已访问的文件,以追踪正在访问这些文件的程序。此命令将监视特定目录 X 分钟:

inotifywatch -v -e 访问 -e 修改 -t “$TIME” -r “$STORAGE”

将“$TIME”替换为需要监视的秒数长度,将“$STORAGE”替换为您要监视的目录。

答案2

根据我的经验,udisksd守护进程总是罪魁祸首。如果你可以卸载它,我羡慕你;如果它依赖于一堆 GUI 程序,依赖于(对我来说是 KDE4)这是我的解决方法:

假设您已为硬盘设置了空闲超时(hdparm -S),sudo killall -SIGSTOP udisksd现在看看它们是否能自行降速。您甚至不需要卸载它们——只要它们不被访问就足够了。如果您的文件系统已挂载noatime,并且您有足够的页面缓存,这意味着您不能给他们。

如果这样做有效,您很快就会发现在某些情况下您的 GUI 程序会挂起。根据我的经验,KDE4 启动和打开/保存对话框会挂起。解决方案是简单地再次解冻守护进程:sudo killall -SIGCONT udisksd。谢天谢地,这不会再次启动您的磁盘,否则这个技巧就毫无用处了!但是,只要守护进程启动,它们就会全部启动,这就是为什么停止它是无用的。为了方便起见,您可能需要一个 cron 作业来执行冻结,这样您就可以专注于解冻——您将不得不经常这样做……

相关内容