Cpanel 14

Limit number of kernels in CentOS


If you receive a notification with the subject DISKCRITICAL blocks: Mount Point “/boot”, it is likely that your CentOS operating system is retaining more kernel versions than necessary.

What is the kernel?

According to Wikipedia: "The Linux kernel is a free and open-source, monolithic, modular, multitasking, Unix-like operating system kernel."
In simpler terms, the kernel is the core component that facilitates communication between your hardware (CPU, memory, hard drive, etc.) and the software you use. It is essential for your computer or server to function correctly.

By default, CentOS retains the last 5 versions of the kernel. The error message you received is most likely due to this limit causing your /boot partition to reach capacity. Fortunately, there is an easy fix.

How to Limit the Number of Old Kernels

  1. Install the yum-utils package:
    yum install yum-utils
  2. Remove old kernels, keeping only the latest two:
    package-cleanup --oldkernels --count=2
  3. Make this change permanent by editing /etc/yum.conf and setting installonly_limit:
    installonly_limit=2

You're all set! CentOS will now keep only the current kernel and the previous two versions, allowing you to roll back if needed while preventing your /boot partition from filling up.


Was this answer helpful?

One email a month. Endless business benefits.

Don't miss out on WMTWWFY — the newsletter that keeps your website fast, safe, and visible.

« Back
Spinner
aluminium-anthropoid Security Check