How to Clean up the /boot Partition

As updates run on your server over time, you’re likely going to accumulate a number of different kernel versions.  When upgrading within the same OS version, old kernels don’t typically get cleaned up automatically.  This is to enable you to “roll back” to an older kernel if you experience problems with a newer one.

A common consequence of this is the /boot partition filling up with old kernel images.  You can safely uninstall any kernel version that you are not currently running.  To get your current running kernel, use uname:

uname -r

This will output something like:


Now find a list of all installed kernels:

rpm -qa |grep kernel

You can remove the kernel and kernel-devel packages for any kernel that you are not currently running.  In this example, you’ll not want to remove kernel-2.6.32-431.3.1.el6.x86_64.  You will usually not find more than one instance of kernel-headers or kernel-firmware, but if you do, you can remove the unused version of those too.

Note: If you’re running Ksplice for kernel updates, there are actually two kernels you should not remove: that’s the one listed above, as well as the one shown in the output of “uptrack-uname -r”.  While Ksplice patches the kernel in memory, removing an existing RPM for the acting kernel can cause unpredictable behavior.

Remove the old kernels as so:

rpm -e kernel-2.6.32-358.0.1.el6.x86_64

rpm -e kernel-devel-2.6.32-358.18.1.el6.x86_64

And so on.  Doing this will free up the unneeded files from /boot.