• Managing CentOS/RHEL kernel modules.


    Check current OS modules
    # lsmod
     
    Check modules detail info
    # modinfo  st
    filename:       /lib/modules/2.6.32-279.22.1.el6.x86_64/kernel/drivers/scsi/st.ko
    alias:          scsi:t-0x01*
    alias:          char-major-9-*
    license:        GPL
    description:    SCSI tape (st) driver
    author:         Kai Makisara
    srcversion:     782F465A959216B1E70B888
    depends:
    vermagic:       2.6.32-279.22.1.el6.x86_64 SMP mod_unload modversions
    parm:           buffer_kbs:Default driver buffer size for fixed block mode (KB; 32) (int)
    parm:           max_sg_segs:Maximum number of scatter/gather segments to use (256) (int)
    parm:           try_direct_io:Try direct I/O between user buffer and tape drive (1) (int)
    parm:           try_rdio:Try direct read i/o when possible (int)
    parm:           try_wdio:Try direct write i/o when possible (int)
     
    # modinfo -p st            #Only check module st paremeters
    try_wdio:Try direct write i/o when possible
    try_rdio:Try direct read i/o when possible
    try_direct_io:Try direct I/O between user buffer and tape drive (1)
    max_sg_segs:Maximum number of scatter/gather segments to use (256)
    buffer_kbs:Default driver buffer size for fixed block mode (KB; 32)
     
    Load module
    # lsmod |grep st
    stp                     2173  1 garp
    llc                     5546  2 garp,stp
    # modprobe st
    # lsmod |grep st
    st                     38302  0
    stp                     2173  1 garp
    llc                     5546  2 garp,stp
     
    Unload module
    # rmmod st
    # lsmod |grep st
    stp                     2173  1 garp
    llc                     5546  2 garp,stp
     
    Set default modules parameters
    1. Check module's default parameter value
    a. Load modules
    # modprobe usb_storage
    # modprobe st
    # modprobe sx8
     
    b. Get module's parameter info
    # modinfo -p usb_storage
    quirks:supplemental list of device IDs and their quirks
    delay_use:seconds to delay before using a new device
    swi_tru_install:TRU-Install mode (1=Full Logic (def), 2=Force CD-Rom, 3=Force Modem)
    option_zero_cd:ZeroCD mode (1=Force Modem (default), 2=Allow CD-Rom
     
    # modinfo -p st
    try_wdio:Try direct write i/o when possible
    try_rdio:Try direct read i/o when possible
    try_direct_io:Try direct I/O between user buffer and tape drive (1)
    max_sg_segs:Maximum number of scatter/gather segments to use (256)
    buffer_kbs:Default driver buffer size for fixed block mode (KB; 32)
     
    # modinfo -p sx8
    max_queue:Maximum number of queued commands. (min==1, max==30, safe==1)
     
    c. Check the default value
    # cat /sys/module/usb_storage/parameters/delay_use
    1
     
    # cat /sys/module/sx8/parameters/max_queue
    1
     
    2. Modify the default value
    a. Set parameter value
    # cat /etc/modprobe.d/my.conf
    options usb_storage delay_use=3
    options sx8 max_queue=15
    options st buffer_kbs=256
     
    b. Reload modules
    # rmmod st
    # rmmod sx8
    # rmmod usb_storage
    # modprobe st
    # modprobe sx8
    # modprobe usb_storage
     
    c. Check you changed value
    # cat /sys/module/usb_storage/parameters/delay_use
    3
    # cat /sys/module/sx8/parameters/max_queue
    15
     
    3. Set module auto-start with modified parameter
    系统是如何自动加载模块呢,我们在/etc/rc.sysinit启动文件中看到下面内容。在系统启动过程中会自动的执行/etc/sysconfig/modules/下所有以.modules结尾的文件。那么我们也可以在该目录下编写自定义的脚本,在配合/etc/modprobe.d/my.conf设置的参数,就可以实现我们设置的参数开机自启动了。
    # Load other user-defined modules
    for file in /etc/sysconfig/modules/*.modules ; do
      [ -x $file ] && $file
    done
     
    a. Create self-definition script
    # cat /etc/sysconfig/modules/my.modules
    modprobe st
    modprobe sx8
    modprobe usb_storage
     
    b. Do not forget add execute permission
    # chmod a+x /etc/sysconfig/modules/my.modules
    # ls -l /etc/sysconfig/modules/my.modules
    -rwxr-xr-x 1 root root 46 Aug 22 09:09 /etc/sysconfig/modules/my.modules
     
    4. Disable ipv6 module on RHEL/CentOS 5.
    Modify below to files.
    /etc/modprobe.conf - Kernel driver configuration file.
    /etc/sysconfig/network - RHEL / CentOS networking configuration file.
     
    a. Edit /etc/modprobe.conf, and append the following line:
    # vi /etc/modprobe.conf
    install ipv6 /bin/true
     
    b. Edit /etc/sysconfig/network, and update / add as follows:
    # vi /etc/sysconfig/network
     
    NETWORKING_IPV6=no
    IPV6INIT=no

    c. Restart network service.
    # service network restart
    # rmmod ipv6
     
    Alternatively, simple reboot the box:
    # reboot
     
    d. Verify IPv6 is disabled, enter:
    # lsmod | grep ipv6
    # /sbin/ifconfig
     
    5. Disable ipv6 module on RHEL/CentOS 6.
    a.Edit /etc/sysconfig/network, and update / add as follows:
    NETWORKING_IPV6=no
     
    b. Modify file /etc/hosts, and comment out below line:
    #::1   localhost localhost6 localhost6.localdomain6
     
    c. Restart network service.
    # service network restart
    # rmmod ipv6
     
    d. Disable auto enable across OS reboot. And below contents in file /etc/modprobe.d/ipv6off.conf.
    alias net-pf-10 off
    options ipv6 disable=1
  • 相关阅读:
    paip.禁用IKAnalyzer 的默认词库.仅仅使用自定义词库.
    paip.语义分析分词常见的单音节字词 2_deDuli 单字词 774个
    IFL嵌入式小组技术博客入口导航
    devc++5.0.0.9的调试方法
    getch()、getche()和getchar()之间的区别
    devc++5.0.0.9的调试方法
    声明和定义的区别
    IFL嵌入式小组技术博客入口导航
    C/C++程序到内存分配个人总结
    getch()、getche()和getchar()之间的区别
  • 原文地址:https://www.cnblogs.com/torvalds0310/p/4447302.html
Copyright © 2020-2023  润新知