• How to disable crashkernel on CentOS 7

There is a feature called "crashkernel" that is enabled by default on CentOS. This feature reserves a significant amount of memory for its exclusive use; memory that is not usable by your applications. You can tell if this feature is enabled by checking dmesg after boot:

dmesg | grep Reserving

[0.000000] Reserving 161MB of memory at 656MB for crashkernel (System RAM: 4095MB)

So the example above shows 161MB of memory reserved for this feature. If the kernel ever crashes, its state is copied into this reserved memory and after rebooting you can use a tool called "kdump" to copy that memory to a file and potentially get someone to debug the cause of the kernel crash.

For the vast majority of servers the kernel will never crash; and if it ever does most users will reboot and make sure the latest version is installed. If kernel crashes are rare and determining the exact cause of a crash is not important, then "crashkernel" is reserving memory for a feature that will never be utilised. So it makes sense to disable it:

sed -i 's/crashkernel=auto/crashkernel=no/' /etc/default/grub

grub2-mkconfig -o /boot/grub2/grub.cfg

Generating grub configuration file ...
[snipped]
done

reboot

After the reboot completes, check dmesg to confirm it is disabled:

dmesg | grep Reserving

no output

And lastly, confirm that more memory is available:

free -m
          total        used        free      shared  buff/cache   available

Mem: 3952 82 3746 16 123 3679 Swap: 0 0 0

As expected, a further 161MB of memory is available to use.


This article was last modified: Jan. 9, 2020, 11:17 a.m.

0 Comments

Please log in to leave a comment.

Add or change tags.

A comma-separated list of tags.

Share

Hacker News

Top