如何在关闭某个模块

有些时候,我们并不需要一些特殊的模块,或者个别模块对我们的硬件支持不是那么好,这就需要在内核将它们关闭,编辑下述文件即可:

[root@imysql.cn ]# cat /etc/hotplug/blacklist
#
# Listing a module here prevents the hotplug scripts from loading it.
# Usually that'd be so that some other driver will bind it instead,
# no matter which driver happens to get probed first.  Sometimes user
# mode tools can also control driver binding.
#
# Syntax:  driver name alone (without any spaces) on a line. Other
# lines are ignored.
#
#diasble usb_storage
usb_storage
#disable edac
i5000_edac
edac_mc

只需要往 /etc/hotplug/blacklist中添加一行,然后重启系统即可生效。
上面的方法适用于AS4的系统,但如果是AS5的系统,方法就不一样了,编辑/etc/modprobe.conf,内容类似:

[root@imysql.cn ]# cat /etc/modprobe.conf
alias eth0 bnx2
#disable lists
alias power_meter off
alias hwmon off

同样地,重启系统即可。
如果想立刻生效,也可以执行rmmod命令,但个别内核模块删除后,报错信息仍然继续产生,想要彻底清净的话,就参照上述方法吧。

技术相关: