Question

How to Free Up Space in /boot on CentOS Server

I have a CentOS box at home and I’m trying to install the latest Kernel but it is failing as my /boot partition is too small and there’s not enough space.

Can I just use rm and delete some of the old Kernels stored in there? Or do I have to resize the partition so that I could have more space? Or is there a better way to sort that out?

Thank you!


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

Hello,

I’ve noticed that with CentOS by default the /boot partition is quite small, in some cases it could be only a few megabytes. If this is the case with when you try to update your kernel, you could get an error complaining about not enough free space on /boot.

I would strongly recommend not using the rm command! Here’s an easy and safe way on how to free up some space so that you could complete your kernel update as normal.

  • Install yum-utils
yum install yum-utils
  • Now we can clean some old kernel packages, to be on the safe side I would recommend keeping the --count argument to at least 2:
package-cleanup --oldkernels --count=2

This is pretty much it, you can then go ahead and update your kernel as normal:

yum -y update kernel kernel-headers

Please note that you would need to reboot your server in order for the change to take effect.

To check your system information you could then simply run:

uname -a

Hope that this helps! Regards, Bobby Source

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel