January 2020 1 post
Disabling kdump to reclaim missing RAM on CentOS 8
Saturday, January 25, 2020
After setting up a Droplet on DigitalOcean (a VPS) using their CentOS 8 image, I found that various sources (like top
, free
, and even /proc/meminfo
) were reporting only 821 MB of total RAM, even though the instance should have had 1 GB. Where did the missing ~200 MB go?
It turns out that kdump is enabled by default. In short, it uses a second kernel to capture dumps in case the running kernel crashes. I don't need this since I'm not going to do anything useful with those dumps anyway, so here's how to disable it and get the memory back.
First, check to see if it's enabled by looking for a nonzero value in /sys/kernel/kexec_crash_size
:
$ cat /sys/kernel/kexec_crash_size
You'll also see a line like this in dmesg
:
kernel: Reserving 160MB of memory at 672MB for crashkernel (System RAM: 1023MB)
To disable it, edit /etc/default/grub
and change crashkernel=auto
to crashkernel=no
, then:
# grub2-mkconfig -o /boot/grub2/grub.cfg # systemctl disable kdump # reboot
On EL9 (AlmaLinux 9, Rocky Linux 9, etc) with BLS, try grubby instead:
# grubby --info=DEFAULT # grubby --update-kernel ALL --args 'crashkernel=no' # reboot
Now you should have your memory back!