Grub2 内核启动参数总结
部分参数
biosdevname=0
net.ifnames=0
# 注意这个配置会修改网卡的名字, 比如之前是ens192
# 添加如上两个内容后就会变成 eth0 类似于CentOS6的命令特点.
# 注意修改了网卡名称会导致机器无法上网, 需要通过控制台连接机器, 并且修改
# /etc/sysconfig/network-scprits 下面的 配置文件, 注意文件名和文件内部的name都要进行修改.
ipv6.disable=1
# 会关闭ipv6 的设置, 查不到ipv6的地址.
audit=0
# 关闭审计, 性能会有所提升.
numa=off
# 关闭unma分一致性内存访问, Oracle等大型内存应用强烈建议.
transparent_hugepage=never
# 关闭透明大页. 也是强烈建议关闭的.
修改方法
vim /etc/default/grub
在如下行的 最后面 双引号内部添加上一段就可以了.
GRUB_CMDLINE_LINUX=" xxxxx net.ifnames=0 ipv6.disable=1 numa=off transparent_hugepage=never "
生效设置
grub2-mkconfig -o /boot/grub2/grub.cfg
查看是否生效
cat /boot/grub2/grub.cfg
会看到如下内容, 说明参数有效果
linux /vmlinuz-0-rescue-1b7a5f5e75a347ed83bd41d1d51fd630 root=/dev/mapper/klas-root
ro resume=/dev/mapper/klas-swap rd.lvm.lv=klas/root rd.lvm.lv=klas/swap rhgb quiet crashkernel=1024M,high
audit=0 biosdevname=0 net.ifnames=0 ipv6.disable=1 numa=off transparent_hugepage=never
查看与验证
cat /sys/kernel/mm/transparent_hugepage/enabled
结果
[root@model ~]# numactl --hardware
available: 1 nodes (0)
node 0 cpus: 0 1 2 3 4 5 6 7
node 0 size: 30877 MB
node 0 free: 29060 MB
node distances:
node 0
0: 10
numactl -status
[root@model ~]# cat /sys/kernel/mm/transparent_hugepage/enabled
[always] madvise never
[root@model ~]# ifconfig
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 02:42:de:86:b6:59 txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ens192: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.255.94 netmask 255.255.255.128 broadcast 192.168.255.127
inet6 fe80::c873:178d:36cc:b434 prefixlen 64 scopeid 0x20<link>
inet6 fe80::ffad:f89d:3e00:e470 prefixlen 64 scopeid 0x20<link>
inet6 fe80::43dd:f1cf:9d69:75e1 prefixlen 64 scopeid 0x20<link>
ether 00:50:56:b0:19:d2 txqueuelen 1000 (Ethernet)
RX packets 458221 bytes 43424710 (41.4 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4691 bytes 364036 (355.5 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 60 bytes 4748 (4.6 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 60 bytes 4748 (4.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
重启后的效果
[root@model ~]# cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]
# never 意味着关闭了透明大页
[root@model ~]# ifconfig
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 10.233.0.1 netmask 255.255.0.0 broadcast 10.233.255.255
ether 02:42:b5:8c:31:c4 txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.255.94 netmask 255.255.255.128 broadcast 192.168.255.127
ether 00:50:56:b0:19:d2 txqueuelen 1000 (Ethernet)
RX packets 5308 bytes 352635 (344.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 291 bytes 45198 (44.1 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
loop txqueuelen 1000 (Local Loopback)
RX packets 144 bytes 10576 (10.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 144 bytes 10576 (10.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
# IPV6的地址没有了,网卡名称也发生了变化.
标签:errors,TX,RX,bytes,overruns,Grub2,参数,内核,dropped
From: https://www.cnblogs.com/jinanxiaolaohu/p/17786061.html