5.3 Loading and Unloading Modules

The modprobe command loads kernel modules, for example:

# modprobe nfs
# lsmod | grep nfs
nfs                   266415  0 
lockd                  66530  1 nfs
fscache                41704  1 nfs
nfs_acl                 2477  1 nfs
auth_rpcgss            38976  1 nfs
sunrpc                204268  5 nfs,lockd,nfs_acl,auth_rpcgss

Use the -v verbose option to show if any additional modules are loaded to resolve dependencies.

# modprobe -v nfs
insmod /lib/modules/2.6.32-300.27.1.el6uek.x86_64/kernel/net/sunrpc/auth_gss/auth_rpcgss.ko 
insmod /lib/modules/2.6.32-300.27.1.el6uek.x86_64/kernel/fs/nfs_common/nfs_acl.ko 
insmod /lib/modules/2.6.32-300.27.1.el6uek.x86_64/kernel/fs/fscache/fscache.ko 

To determine the dependencies, the modprobe command queries the /lib/modules/kernel_version/modules.dep file, which the depmod utility creates when you install kernel modules.


modprobe does not reload modules that are already loaded. You must first unload a module before you can load it again.

Use the -r option to unload kernel modules, for example:

# modprobe -rv nfs
rmmod /lib/modules/2.6.32-300.27.1.el6uek.x86_64/kernel/fs/nfs/nfs.ko
rmmod /lib/modules/2.6.32-300.27.1.el6uek.x86_64/kernel/fs/lockd/lockd.ko
rmmod /lib/modules/2.6.32-300.27.1.el6uek.x86_64/kernel/fs/fscache/fscache.ko

Modules are unloaded in the reverse order that they were loaded. Modules are not unloaded if a process or another loaded module requires them.


modprobe uses the insmod and rmmod utilities to load and unload modules. As insmod and rmmod do not resolve module dependencies, do not use these utilities.

For more information, see the modprobe(8) and modules.dep(5) manual pages.