Rocky9 关闭kdump增大内存
相信大家会有这种经历:购买了一台1G内存的VPS,结果发现内存不够1G。内存的厂家一般是按照1G=1000MB来算,而不是按照1024MB算的,所以最终可能只有976M左右,可是明明买的是1G内存的VPS可是可用内存只有700多M,这就不对了,究其原因原来是打开了kdump导致的。
于是一顿搜索,最终在Rocky Linux官方论坛找到了解决方法:
1. 禁用kdump服务
systemctl stop kdump
systemctl disable kdump
2. 查看配置信息
[root@rocky9 ~]# dmesg | grep -i crash
[ 0.000000] Command line: BOOT_IMAGE=(hd0,msdos1)/boot/vmlinuz-5.14.0-362.18.1.el9_3.x86_64 root=UUID=b5e3355a-1ec0-44c0-bec7-fba810bf7b3e ro crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M
[ 0.027658] Reserving 256MB of memory at 1776MB for crashkernel (System RAM: 4095MB)
[ 0.062017] Kernel command line: BOOT_IMAGE=(hd0,msdos1)/boot/vmlinuz-5.14.0-362.18.1.el9_3.x86_64 root=UUID=b5e3355a-1ec0-44c0-bec7-fba810bf7b3e ro crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M
3. 更改配置信息
[root@rocky9 ~]# grubby --update-kernel=ALL --args="crashkernel=no"
[root@rocky9 ~]# grubby --info /boot/vmlinuz-5.14.0-362.18.1.el9_3.0.1.x86_64
index=1
kernel="/boot/vmlinuz-5.14.0-362.18.1.el9_3.0.1.x86_64"
args="ro crashkernel=no"
root="UUID=b5e3355a-1ec0-44c0-bec7-fba810bf7b3e"
initrd="/boot/initramfs-5.14.0-362.18.1.el9_3.0.1.x86_64.img"
title="Rocky Linux (5.14.0-362.18.1.el9_3.0.1.x86_64) 9.3 (Blue Onyx)"
id="269bb085de0744ab8477fd952e23fbc4-5.14.0-362.18.1.el9_3.0.1.x86_64"
4. 重启后再确认配置信息-crashkernel已经被禁用
[root@rocky9 ~]# dmesg | grep -i crash
[ 0.000000] Command line: BOOT_IMAGE=(hd0,msdos1)/boot/vmlinuz-5.14.0-362.24.1.el9_3.x86_64 root=UUID=b5e3355a-1ec0-44c0-bec7-fba810bf7b3e ro crashkernel=no
[ 0.026246] crashkernel: memory value expected
[ 0.052301] Kernel command line: BOOT_IMAGE=(hd0,msdos1)/boot/vmlinuz-5.14.0-362.24.1.el9_3.x86_64 root=UUID=b5e3355a-1ec0-44c0-bec7-fba810bf7b3e ro crashkernel=no
##彻底删除crashkernel配置信息##
grubby --remove-args="crashkernel=no" --update=ALL
查询论坛地址: https://forums.rockylinux.org/t/how-do-i-remove-crashkernel-from-cmdline/13346/8