|
1 | | -modprobe |
2 | | -=== |
3 | | - |
4 | | -自动处理可载入模块 |
5 | | - |
6 | | -## 补充说明 |
7 | | - |
8 | | -**modprobe命令** 用于智能地向内核中加载模块或者从内核中移除模块。 |
9 | | - |
10 | | -modprobe可载入指定的个别模块,或是载入一组相依的模块。modprobe会根据depmod所产生的相依关系,决定要载入哪些模块。若在载入过程中发生错误,在modprobe会卸载整组的模块。 |
11 | | - |
12 | | -### 语法 |
13 | | - |
14 | | -``` |
15 | | -modprobe(选项)(参数) |
16 | | -``` |
17 | | - |
18 | | -### 选项 |
19 | | - |
20 | | -``` |
21 | | --a或--all:载入全部的模块; |
22 | | --c或--show-conf:显示所有模块的设置信息; |
23 | | --d或--debug:使用排错模式; |
24 | | --l或--list:显示可用的模块; |
25 | | --r或--remove:模块闲置不用时,即自动卸载模块; |
26 | | --t或--type:指定模块类型; |
27 | | --v或--verbose:执行时显示详细的信息; |
28 | | --V或--version:显示版本信息; |
29 | | --help:显示帮助。 |
30 | | -``` |
31 | | - |
32 | | -### 参数 |
33 | | - |
34 | | -模块名:要加载或移除的模块名称。 |
35 | | - |
36 | | -### 实例 |
37 | | - |
38 | | - **查看modules的配置文件:** |
39 | | - |
40 | | -``` |
41 | | -modprobe -c |
42 | | -``` |
43 | | - |
44 | | -这里,可以查看modules的配置文件,比如模块的alias别名是什么等。会打印许多行信息,例如其中的一行会类似如下: |
45 | | - |
46 | | -``` |
47 | | -alias symbol:ip_conntrack_unregister_notifier ip_conntrack |
48 | | -``` |
49 | | - |
50 | | - **列出内核中所有已经或者未挂载的所有模块:** |
51 | | - |
52 | | -``` |
53 | | -modprobe -l |
54 | | -``` |
55 | | - |
56 | | -这里,我们能查看到我们所需要的模块,然后根据我们的需要来挂载;其实`modprobe -l`读取的模块列表就位于`/lib/modules/`uname -r``目录中;其中`uname -r`是内核的版本,例如输出结果的其中一行是: |
57 | | - |
58 | | -``` |
59 | | -/lib/modules/2.6.18-348.6.1.el5/kernel/net/netfilter/xt_statistic.ko |
60 | | -``` |
61 | | - |
62 | | - **挂载vfat模块:** |
63 | | - |
64 | | -``` |
65 | | -modprobe vfat |
66 | | -``` |
67 | | - |
68 | | -这里,使用格式`modprobe 模块名`来挂载一个模块。挂载之后,用lsmod可以查看已经挂载的模块。模块名是不能带有后缀的,我们通过`modprobe -l`所看到的模块,都是带有`.ko`或`.o`后缀。 |
69 | | - |
70 | | - **移除已经加载的模块:** |
71 | | - |
72 | | -``` |
73 | | -modprobe -r 模块名 |
74 | | -``` |
75 | | - |
76 | | -这里,移除已加载的模块,和rmmod功能相同。 |
77 | | - |
78 | | - |
79 | | -<!-- Linux命令行搜索引擎:https://jaywcjlove.github.io/linux-command/ --> |
| 1 | +modprobe |
| 2 | +=== |
| 3 | + |
| 4 | +自动处理可载入模块 |
| 5 | + |
| 6 | +## 补充说明 |
| 7 | + |
| 8 | +**modprobe命令** 用于智能地向内核中加载模块或者从内核中移除模块。 |
| 9 | + |
| 10 | +modprobe可载入指定的个别模块,或是载入一组相依的模块。modprobe会根据depmod所产生的相依关系,决定要载入哪些模块。若在载入过程中发生错误,在modprobe会卸载整组的模块。 |
| 11 | + |
| 12 | +### 语法 |
| 13 | + |
| 14 | +``` |
| 15 | +modprobe(选项)(参数) |
| 16 | +``` |
| 17 | + |
| 18 | +### 选项 |
| 19 | + |
| 20 | +``` |
| 21 | +-a或--all:载入全部的模块; |
| 22 | +-c或--show-conf:显示所有模块的设置信息; |
| 23 | +-d或--debug:使用排错模式; |
| 24 | +-l或--list:显示可用的模块; |
| 25 | +-r或--remove:模块闲置不用时,即自动卸载模块; |
| 26 | +-t或--type:指定模块类型; |
| 27 | +-v或--verbose:执行时显示详细的信息; |
| 28 | +-V或--version:显示版本信息; |
| 29 | +-help:显示帮助。 |
| 30 | +``` |
| 31 | + |
| 32 | +### 参数 |
| 33 | + |
| 34 | +模块名:要加载或移除的模块名称。 |
| 35 | + |
| 36 | +### 实例 |
| 37 | + |
| 38 | + **查看modules的配置文件:** |
| 39 | + |
| 40 | +``` |
| 41 | +modprobe -c |
| 42 | +``` |
| 43 | + |
| 44 | +这里,可以查看modules的配置文件,比如模块的alias别名是什么等。会打印许多行信息,例如其中的一行会类似如下: |
| 45 | + |
| 46 | +``` |
| 47 | +alias symbol:ip_conntrack_unregister_notifier ip_conntrack |
| 48 | +``` |
| 49 | + |
| 50 | + **列出内核中所有已经或者未挂载的所有模块:** |
| 51 | + |
| 52 | +``` |
| 53 | +modprobe -l |
| 54 | +``` |
| 55 | + |
| 56 | +这里,我们能查看到我们所需要的模块,然后根据我们的需要来挂载;其实`modprobe -l`读取的模块列表就位于/lib/modules/\`uname -r \`目录中;其中`uname -r`是内核的版本,例如输出结果的其中一行是: |
| 57 | + |
| 58 | +``` |
| 59 | +/lib/modules/2.6.18-348.6.1.el5/kernel/net/netfilter/xt_statistic.ko |
| 60 | +``` |
| 61 | + |
| 62 | + **挂载vfat模块:** |
| 63 | + |
| 64 | +``` |
| 65 | +modprobe vfat |
| 66 | +``` |
| 67 | + |
| 68 | +这里,使用格式`modprobe 模块名`来挂载一个模块。挂载之后,用lsmod可以查看已经挂载的模块。模块名是不能带有后缀的,我们通过`modprobe -l`所看到的模块,都是带有`.ko`或`.o`后缀。 |
| 69 | + |
| 70 | + **移除已经加载的模块:** |
| 71 | + |
| 72 | +``` |
| 73 | +modprobe -r 模块名 |
| 74 | +``` |
| 75 | + |
| 76 | +这里,移除已加载的模块,和rmmod功能相同。 |
| 77 | + |
| 78 | + |
| 79 | +<!-- Linux命令行搜索引擎:https://jaywcjlove.github.io/linux-command/ --> |
0 commit comments