After installing CentOS 8 using either a VPS server provider template or CentOS ISO you may notice that the amount of RAM available to your server is less than advertised. This isn’t because your server has been setup wrong but is usually due to kdump being enables by default.
kdump is a core feature of the CentOS kernel which reserves a small amount of RAM for creating crash dumps should a kernel unexpectedly crash. When triggered kdump will export a memory image that can be utilised for debugging to determine the cause of the crash.
In the example below, which was taken from one of our servers, you can see the total system RAM is showing as 2834MB (2.83GB) when this server has 3072MB (3GB) of RAM allocated. This roughly means 160MB of system RAM has been allocated to kdump.
[root@vpsbasics] # free -m total used free shared buff/cache available Mem: 2834 208 1136 137 1489 2315 Swap: 1023 0 1023
However, most people won’t be using this information nor examining the memory images kdump creates and therefore do not require kernel core dumps to be enabled. Luckily, it is easy to disable kdump and reclaim the missing system RAM.
In this guide, we will show you how to check if kdump is running and its current status. If it is running we will show you how to disable kdump service and edit the grub file to disable kdump in the kernel as well.
You can check the status of kdump using the following command.
systemctl status kdump
This will check if the kdump service is running and currently enabled on your system. If the service is running you will see a similar output below.
[root@vpsbasics] # systemctl status kdump ● kdump.service - Crash recovery kernel arming Loaded: loaded (/usr/lib/systemd/system/kdump.service; enabled; vendor preset: enabled) Active: active (exited) since Fri 2020-09-18 09:08:48 CEST; 3 weeks 3 days ago Main PID: 904 (code=exited, status=0/SUCCESS) Tasks: 0 (limit: 17934) Memory: 0B CGroup: /system.slice/kdump.service Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.
Now you can stop the kdump service and disable it from starting automatically using the following command.
systemctl stop kdump && systemctl disable kdump
At this point the RAM assigned to kdump will not magically reappear. To enable the permanent kernel change, we will need to adjust the setting in the CentOS 8 kernel by editing the /etc/default/grub
file using the following command.
nano /etc/default/grub
Look for the line beginning with GRUB_CMDLINE_LINUX=
. Within this line you will see crashkernel=auto
which you will need to change to crashkernel=no
Now save and exit the file. At this point it is important that you update the grub file using the following command.
grub2-mkconfig -o /boot/grub2/grub.cfg
You will then see that grub is Generating grub configuration file … and then followed by done before returning to the command prompt. At this point you can safely reboot you server using the following command.
reboot
Once the server has come back up, simply login and free check the current system RAM using the following command.
free -m
In the example below, which was taken from one of our servers, you can see the missing 160MB of RAM has now been added back to the system RAM and is showing the correct amount as 2994MB (2.99GB).
[root@vpsbasics] # free -m total used free shared buff/cache available Mem: 2994 186 2506 9 302 2653 Swap: 1023 0 1023
That’s it. You have successfully checked, stopped and disabled the kdump service from running and edited the the grub file to disable kdump in the system kernel as well.