Posts Tagged ‘centos’

CentOS: remove old/unused kernels

Tuesday, August 24th, 2021

Install ‘yum-utils’ package.

Before:

voip ~ # uname -sr
Linux 3.10.0-327.36.2.el7.x86_64
voip ~ # rpm -q kernel
kernel-3.10.0-327.el7.x86_64
kernel-3.10.0-327.10.1.el7.x86_64
kernel-3.10.0-327.18.2.el7.x86_64
kernel-3.10.0-327.36.2.el7.x86_64


voip ~ # df -h | grep boot
/dev/md126p1 283M 212M 52M 81% /boot

Let’s leave 2 kernels, others will be removed. Use ‘package-cleanup’ tool:

voip ~ # package-cleanup --oldkernels --count=2
...

Result:

voip ~ # uname -sr
Linux 3.10.0-327.36.2.el7.x86_64
voip ~ # rpm -q kernel
kernel-3.10.0-327.18.2.el7.x86_64
kernel-3.10.0-327.36.2.el7.x86_64


voip ~ # df -h | grep boot
/dev/md126p1 283M 127M 138M 48% /boot