How safely free space in /boot

I have to admit that I’m a newbie using CentOS, that was the point because I decided install it on my server to learn from practice. I’m get used to managing my Debian GNU/Linux box and there are things that I have to write just to remember them, that’s the reason for this entry.

Updating the system (yum update) I found the following message:

Transaction check error:
 installing package kernel-3.10.0-327.18.2.el7.x86_64 needs 30MB on the /boot filesystem

Error Summary
 -------------
 Disk Requirements:
 At least 30MB more space needed on the /boot filesystem.

The df command confirms the bad news:
# df -h
Filesystem               Size  Used Avail Use% Mounted on
...
/dev/sda1                239M  235M     0 100% /boot
...

If you have some old kernel versions the easiest way to solve space problem in boot partition in pretty obvious, remove unused old versions, so let’s to list kernel versions installed in our system:
# rpm -qa kernel |sort -V
kernel-3.10.0-229.1.2.el7.x86_64
kernel-3.10.0-229.11.1.el7.x86_64
kernel-3.10.0-229.el7.x86_64
kernel-3.10.0-327.10.1.el7.x86_64

The same information will be got with this:
# yum list installed|grep ^kernel

Now we can use package-cleanup command to remove the old ones, in this case I decided to use --count=2 the leave the latest version and other one just in case.

# package-cleanup --oldkernels --count=2
...
Removed:
kernel.x86_64 0:3.10.0-229.el7         kernel.x86_64 0:3.10.0-229.1.2.el7         kernel-devel.x86_64 0:3.10.0-229.el7         kernel-devel.x86_64 0:3.10.0-229.1.2.el7
Complete!

# df -h
Filesystem Size Used Avail Use% Mounted on
...
/dev/sda1 239M 134M 88M 61% /boot
...

As yum update wanted to install a new kernel version, we’ll have to repeat the same package-cleanup to leave just two kernel versions in our system once system update have finished properly.

“Be yourself; everyone else is already taken.”
-Oscar Wilde

One thought on “How safely free space in /boot

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s