Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want to know the kernel modules which are not being used now. So, that I can disable them from loading at boot time?

Is there any method to see which kernel modules (of course, loaded) are not in use?

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

Most modules are automatically loaded only because the corresponding hardware was detected

lsmod shows you the currently loaded modules, as (excerpt):

Module                  Size  Used by
...
psmouse                87692  0 
bluetooth             180104  7 bnep
parport                46562  3 lp,parport_pc,ppdev
serio_raw              13211  0 
snd_ens1371            25747  4 
gameport               19693  1 snd_ens1371
snd_ac97_codec        134826  1 snd_ens1371
joydev                 17693  0 
...

However, just because Used is 0 for a particular module does not mean it is not in use!

Note that the kernel autoloads modules based on the hardware detected, except for the modules listed in /etc/modules, which are "force"-loaded.

Removal/blacklisting will disable hardware; no real need on modern systems with more than 512MB of RAM

So if you remove or blacklist any of these modules beware: that piece of hardware may no longer work. e.g. if I remove/blacklist parport, my parallel port won't work, which is OK if I never use it. The same goes for bluetooth ,etc.

The kernel modules take up relatively little memory on a modern PC, so the only time I'd recommend this kind of manual "optimization" is on embedded systems, etc. with little RAM.


For Disabling the modules

From a later comment by OP, It seems that, he wanted to know the loaded unused modules names to disable them from auto loading in the boot time. It can be achieved by blacklisting them.

share|improve this answer
    
Thanks for the quick answer. Can i know more precisely How much RAM can I save by disabling them (if I disable them)? –  Anwar Shah Jun 30 '12 at 9:40
    
It's the number of bytes shown in the Size column of lsmod –  izx Jun 30 '12 at 9:44
    
Thanks, I actually wanted to disable them to decrease boot time. –  Anwar Shah Jul 1 '12 at 13:16
    
@AnwarShah, then disable the ones for hardware you don't use/need (blacklist) -- this won't work for built-in modules though. And an upvote and accept (if you feel the answer deserves it) would be appreciated :) –  izx Jul 1 '12 at 13:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.