How to free up space on RHEL6 /boot safely?

Solution 1:

As per the recommendation of MadHatter here. I will post my answer here as an addendum to the answers here so that it may be used in conjunction with the answers suggested here.

Taken from the following website

## Install yum utils ##
yum install yum-utils

## Package-cleanup set count as how many old kernels you want left ##
package-cleanup --oldkernels --count=2

This will remove all older kernels and keep only the two most recent kernels on centos 6.4 which is probably what you want since recent kernels contain bug fixes and you can always failover to the older kernels if the new ones fail to boot. The above command means that you don't have to go and say rpm -e xyz where xyz is your specific kernel since it automatically keeps the newest ones.

Note that the above command only cleans up existing packages so editing your yum.conf is necessary if you don't want to start accumulating kernel packages again.

Solution 2:

Following command will remove ALL kernel versions, except for the one that you're currently running:

sudo yum remove `rpm -q kernel | grep -v 'uname -r'`

and for going forward, per ⁠7.4. Configuring Yum and Yum Repositories:

⁠installonly_limit=value

…where value is an integer representing the maximum number of versions that can be installed simultaneously for any single package listed in the installonlypkgs directive. The defaults for the installonlypkgs directive include several different kernel packages, so be aware that changing the value of installonly_limit will also affect the maximum number of installed versions of any single kernel package. The default value listed in /etc/yum.conf is installonly_limit=3, and it is not recommended to decrease this value, particularly below 2.


Solution 3:

Delete at least one of the old kernels, as alexus said.

Then:

Edit /etc/yum.conf and specify the limit of the number of kernel versions to keep. It's set to 5 by default, but your system seems to be capable of handling only two:

installonly_limit=2

Finally, complain to the VPS provider about the strange template. /boot is 500MB by default in a CentOS 6 installation.

Tags:

Redhat

Boot

Rhel6