每次update-grub运行时都会扫描所有硬盘驱动器。处于待机状态的每个驱动器都将启动以进入空闲状态。这是一种能源浪费。我们使用 update-grub 1.98 版:
# update-grub -v
grub-mkconfig (GRUB) 1.98+20100804-14+squeeze1
Run Code Online (Sandbox Code Playgroud)
回归
文件中有一个GRUB_DISABLE_OS_PROBER=true选项/etc/default/grub。但这似乎只适用于版本 2 及更高版本。至少它不会停止扫描我们 1.98 版中的所有驱动器。
有一个/etc/grub.d/20_linux_xen脚本可以作为 update-grub 的一部分运行。删除chmod a-x /etc/grub.d/20_linux_xen所有驱动器的所有用户的执行权限后,它仍然会启动。
如何停止update-grub扫描每个硬盘?
Pro*_*kup 19
In file /etc/grub.d/30_os-prober the line
OSPROBED="`os-prober | tr ' ' '^' | paste -s -d ' '`"
Run Code Online (Sandbox Code Playgroud)
makes all drives spin (standby -> idle). Os-prober is a utility to find Linux installations at drives other then your boot drive. It is the os-prober that needs to be disabled.
apt-get --purge remove os-prober.$ which os-prober. Output might look like: /usr/bin/os-prober. The remove the executable rights for all users for that file: # chmod a-x /usr/bin/os-prober$ locate /30_os-prober. Output might look like: /etc/grub.d/30_os-prober. The remove the executable rights for all users for that file: # chmod a-x /etc/grub.d/30_os-prober/etc/grub.d/30_os-prober. For example by making the GRUB_DISABLE_OS_PROBER=true option work in our grub version 1.98. This can be done by inserting in file /etc/grub.d/30_os-prober the code below the line set -e:...
if [ "x${GRUB_DISABLE_OS_PROBER}" = "xtrue" ]; then
exit 0
fi
Run Code Online (Sandbox Code Playgroud)
小智 6
对于那些想知道它是否真的值得付出努力的人来说,是的。也许不是为了节能,但今天我遇到了 update-grub 的问题,因为它想探测 /dev/sda(我的硬盘)和 /dev/sdc(一个 U 盘)。如果没有将后者插入我的笔记本电脑,update-grub 就会挂起,即使我的 USB 记忆棒上实际上没有安装操作系统,也没有从这个记忆棒启动。由于 USB 记忆棒最近坏了,我需要一种方法让 update-grub 在没有它的情况下继续(活着)。幸运的是,GRUB_DISABLE_OS_PROBER=true刚刚成功。:)