Limit number of kernels in CentOS

If you receive a notification with the subject DISKCRITICAL blocks : Mount Point “/boot”, this is more than likely that you CentOS operating system is keeping more kernels than are really needed.

What is the kernel?

From Wikipedia "The Linux kernel is a free and open-source, monolithic, modular, multitasking, Unix-like operating system kernel.". Clear as mud, right?

In simple terms the kernel is the bit that talks between your hardware (CPU, memory, hardrive, etc) and the software you use. It is crucial to the computer/server working correctly.

By default CentOS will keep the last 5 version of the kernel, and the error message that you received is more that likely due to this limit reaching the capacity of your /boot partition. Luckily there is an easy fix...

Limit the number of old kernels

To get around this issue we can remove any additional kernels and set CentOS to then do this automatically in the future.

First, install the package yum-utils:

yum install yum-utils

Now we can remove the old kernels:

package-cleanup --oldkernels --count=2

Lastly, to ensure this is handled automatically in the future, we can make this permanent by editing /etc/yum.conf and set installonly_limit:


You're now all set. CentOS will now only keep the current kernel and the last 2 versions (to give you a chance to roll back should an issue arise)


  • Cpanel
  • 0 Users Found This Useful
Was this answer helpful?
Couldn't find what you are looking for?