Monday, December 27, 2010

Module management & Tweaking Linux performance.

How to manage modules & tweak kernel ?



Here modules are supporting driver programs to manage our different hardwares. A newly fresh installed Linux system uses nearly 900 to 950 kernel modules. Which takes too much processing power of your Linux Box. But when think about tweaking your kernel it's nothing but the removing or unloading unwanted modules.


How do i find out list of all available kernel modules on my linux box :

#ls -R /lib/modules/$(uname -r) |less



How to display list of loaded modules :

#lsmod |less




How to see more information about module including it's version, dependency etc :

#modinfo <module name>



How to load or install a module :

#insmod <Module Name>

Note : Some times it gets failed because some modules are depend on other modules, so 1st you need to solve dependency problem, with "modprobe" and "depmod" commands. "modprobe" output always depend on the result of "depmod" command to automatically load any dependent modules. "depmod" searches interdependencies among kernel modules and writes the result to "/lib/modules/$(uname -r)/modules.dep" file, then the "modprobe" command reads dependency info from that file. The "depmod" runs & update module database each time you boot sysrem. If you build or install new modules then you have to update that database file manually by,

#depmod -a

Then use modeprobe,

#modprobe <Module Name>


#insmod --force <Module Name> (To install module forcefully without resolving other module dependencies, but will show you error messages)

#modprobe -n -v <Module Name>

Note : Will show you the "insmod" command that you need in order to load dependent modules in the correct order, then you have to run the same commands in order.


How to remove or unload any loaded module :

#rmmod <Module Name>

For More troubleshooting in case you encountering problem related to wrong module insertion, you can follow below tip one by one .

Steps :

A. Boot you PC, keep pressing any key to get Grub screen the select kernel version & "Enter". Now come to second line "kernel /vmlinuz-2.6.18-128.el5 ro root=LABEL=/ rhgb quite", Press "e" to edit, next remove "quiet" & add below options one at a time. Press "Enter", then "b" to boot.

Do you know, What is mean by "rhgb" ? rhgb = Red Hat Graphical Boot.




That's it for now ....

No comments:

Post a Comment