How to Limit the Number of Kernels in CentOS

April 28, 2025 / Command Line

In this article, you will explore how to limit the number of Kernels in CentOS.

If you have received a message like DISKCRITICAL blocks: Mount Point “/boot”, it likely means your CentOS system is storing more Linux kernels than necessary, filling up the “/boot” partition.

What is the Kernel?

The kernel links your system’s hardware, such as the CPU, memory, and hard drives, to the software you run. It is a crucial part of the operating system that ensures everything works together smoothly.

Why This Happens

CentOS, by default, keeps the last five kernel versions. Over time, these can collect and use up all available space in the “/boot” partition.

How to Fix It: Limit Old Kernels
You can clean up unnecessary kernels and set CentOS to manage them automatically.

  1. Install yum-utils:

    yum install yum-utils
  2. Remove Older Kernels (Keep Only 2):

    package-cleanup --oldkernels --count=2
  3. Make It Permanent Edit /etc/yum.conf and add or update this line:
    installonly_limit=2

With this setup, CentOS will keep only the current kernel and the two most recent ones, helping you avoid full “/boot” partitions while still allowing rollback if needed.

Hope you liked our article. However, if you require additional assistance, feel free to contact our support staff.

Looking to modify your server identity? Learn How to change the server hostname on CentOS

Spread the love