CentOS / Redhat boot partition full – remove old kernels

Sometimes /boot partition gets 100% full on a CentOS/Redhat/Fedora system. To resolve this you can use a yum-utils package to clean up older kernels and configure yum not to keep too many versions.

First, make sure yum-utils is installed on your system:

yum install yum-utils

Next, check the list of kernels that you have installed:

rpm -q kernel
kernel-2.6.32-604.30.3.lve1.3.63.el6.x86_64
kernel-2.6.32-673.26.1.lve1.4.20.el6.x86_64
kernel-2.6.32-673.26.1.lve1.4.22.el6.x86_64
kernel-2.6.32-673.26.1.lve1.4.24.el6.x86_64
kernel-2.6.32-673.26.1.lve1.4.27.el6.x86_64

Now to keep only two of the latest kernels, run:

package-cleanup --oldkernels --count=2

To make the change permanent when installing / updating kernels via yum, edit the /etc/yum.conf file and update the following parameter:

installonly_limit=2

That’s all we have to do. You also like to know How To Install Plesk Panel For Linux. Please check and give your opinion below if you experience any issues or to discuss your ideas and experiences.