modprobe命令
modprobe命令主要用于在Linux 2.6内核中加载和删除Linux内核模块。通过此命令用户可以轻松地加载和删除Linux内核模块,同时使用此命令加载Linux内核模块时,Linux内核会自动解决内核模块之间的依赖关系,将相互依赖的模块自动加载,如下所示:
1) 加载RAID1阵列级别模块:
- [root@rhel5 boot]# modprobe raid1
2) 显示已加载的RAID1阵列级别模块:
- [root@rhel5 boot]# lsmod |grep raid1
- raid1 25153 0
3) 删除RAID1阵列级别模块:
- [root@rhel5 boot]# modprobe -r raid1
4) 显示RAID1阵列级别模块:
- [root@rhel5 boot]# lsmod |grep raid1
modprobe命令在加载模块时会自动解决依赖的模块。当加载的模块需依赖另一个模块时,系统会自动将此模块加载。而当用户使用insmod命令加载模块时,则不会自动解决相对应的依赖模块。
modprobe命令中的"-r"参数表示删除指定模块,"-c"参数表示显示/etc/modprobe.conf配置文件的参数,"-C"参数表示指定内核配置文件,"-f"表示覆盖,"-l"表示显示模块的绝对路径。
- [root@rhel5 boot]# modprobe -l|grep raid
- /lib/modules/2.6.18-8.el5/kernel/drivers/md/raid0.ko
- /lib/modules/2.6.18-8.el5/kernel/drivers/md/raid456.ko
- /lib/modules/2.6.18-8.el5/kernel/drivers/md/raid1.ko
- /lib/modules/2.6.18-8.el5/kernel/drivers/md/raid10.ko
- /lib/modules/2.6.18-8.el5/kernel/drivers/scsi/megaraid.ko
- /lib/modules/2.6.18-8.el5/kernel/drivers/scsi/aacraid/aacraid.ko
- /lib/modules/2.6.18-8.el5/kernel/drivers/scsi/megaraid/megaraid_mbox.ko
- /lib/modules/2.6.18-8.el5/kernel/drivers/scsi/megaraid/megaraid_mm.ko
- /lib/modules/2.6.18-8.el5/kernel/drivers/scsi/megaraid/megaraid_sas.ko
- /lib/modules/2.6.18-8.el5/kernel/drivers/scsi/raid_class.ko
以上命令表示显示系统中所有的编译模块,并过滤包含有raid字符串的模块。
hzhsan: 如上部分转自:http://book.51cto.com/art/201006/206467.htm
更多信息,请参考:http://book.51cto.com/art/201006/206424.htm (这里内容丰富哦~)
------------------------------------------------------------------------------------------------
SUSE中安装kvm模块时,会用到modprobe命令来对相应内核模块进行加载。
KVM is not installed by default. To install KVM and all virtualization tools, proceed as follows:
1 Start YaST and choose Virtualization > Installing Hypervisor and Tools.
2 Select KVM and confirm with Accept.
3 Confirm the list of packages that is to be installed with Install.
4 Agree to set up a network bridge by clicking Yes. It is recommended using a bridge
on a VM Host Server (virtual machine host). If you prefer to manually configure a
different network setup, you can safely skip this step by clicking No.
5 After the setup has been finished, reboot the machine as YaST suggests. Alternatively
load the required kernel modules manually and start libvirtd to avoid a reboot:
command: modprobekvm-intel # on Intel machines only
command: modprobe kvm-amd # on AMD machines only
command: modprobe vhost-net
command: rclibvirtd start