linux 内核模块查看,加载,删除命令modprobe

modprobe命令

modprobe命令主要用于在Linux 2.6内核中加载和删除Linux内核模块。通过此命令用户可以轻松地加载和删除Linux内核模块,同时使用此命令加载Linux内核模块时,Linux内核会自动解决内核模块之间的依赖关系,将相互依赖的模块自动加载,如下所示:

1) 加载RAID1阵列级别模块:

 
 
  1. [root@rhel5 boot]# modprobe raid1 

2) 显示已加载的RAID1阵列级别模块:

 
 
  1. [root@rhel5 boot]# lsmod |grep raid1  
  2. raid1                  25153  0 

3) 删除RAID1阵列级别模块:

 
 
  1. [root@rhel5 boot]# modprobe -r raid1 

4) 显示RAID1阵列级别模块:

 
 
  1. [root@rhel5 boot]# lsmod |grep raid1 

modprobe命令在加载模块时会自动解决依赖的模块。当加载的模块需依赖另一个模块时,系统会自动将此模块加载。而当用户使用insmod命令加载模块时,则不会自动解决相对应的依赖模块。

modprobe命令中的"-r"参数表示删除指定模块,"-c"参数表示显示/etc/modprobe.conf配置文件的参数,"-C"参数表示指定内核配置文件,"-f"表示覆盖,"-l"表示显示模块的绝对路径。

 
 
  1. [root@rhel5 boot]# modprobe -l|grep raid  
  2. /lib/modules/2.6.18-8.el5/kernel/drivers/md/raid0.ko  
  3. /lib/modules/2.6.18-8.el5/kernel/drivers/md/raid456.ko  
  4. /lib/modules/2.6.18-8.el5/kernel/drivers/md/raid1.ko  
  5. /lib/modules/2.6.18-8.el5/kernel/drivers/md/raid10.ko  
  6. /lib/modules/2.6.18-8.el5/kernel/drivers/scsi/megaraid.ko  
  7. /lib/modules/2.6.18-8.el5/kernel/drivers/scsi/aacraid/aacraid.ko  
  8. /lib/modules/2.6.18-8.el5/kernel/drivers/scsi/megaraid/megaraid_mbox.ko  
  9. /lib/modules/2.6.18-8.el5/kernel/drivers/scsi/megaraid/megaraid_mm.ko  
  10. /lib/modules/2.6.18-8.el5/kernel/drivers/scsi/megaraid/megaraid_sas.ko  
  11. /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


NOTE: The vhost-net Kernel Module
    The vhost-net kernel module allows for a more efficient network transport to
    the guest. It is automatically used by libvirt if loaded, or when using the
    qemu-kvm command line, by adding ,vhost=on to the networking option.

  • 0
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值