boot partition is almost full in CentOS
Do the following to keep just the last 2 kernels on your system, to keep /boot clean
1 - Edit /etc/yum.conf
and set the following parameter
installonly_limit=2
This will make your package manager keep just the 2 last kernels on your system(including the one that is running)
2 - Install yum-utils
:
yum install yum-utils
3- Make an oldkernel cleanup:
package-cleanup --oldkernels --count=2
Done. This will erase in a good fashion the old kernels, and, keep just the last 2 of them for the next upgrades.
For special cases where you have vmlinuz-0-rescue-*
and initramfs-0-rescue-*
files using too much disk space, please take a look at this question on U&L:
- Removing the rescue image from /boot on fedora
You can delete old kernels safely by doing the following:
# Install the yum-utils if they aren't installed
yum install yum-utils
# Cleanup old kernels and don't keep more than 2
package-cleanup --oldkernels --count=2
And should you wish, you can limit this always by doing the following in /etc/yum.conf
installonly_limit=2
Kernel images are actually really small:
[root@ditirlns01 ~]# ls -lh /boot/vmlinuz-2.6.18-3*
-rw-r--r-- 1 root root 2.2M May 4 2012 /boot/vmlinuz-2.6.18-308.8.1.el5xen
-rw-r--r-- 1 root root 2.2M Jul 27 01:43 /boot/vmlinuz-2.6.18-348.16.1.el5xen
-rw-r--r-- 1 root root 2.2M Mar 22 2013 /boot/vmlinuz-2.6.18-348.4.1.el5xen
There's more to the kernel package, obviously, but that's the part that's on /boot
which is what your concern is.
So with a 100MB /boot
partition, deleting a 2-3MB kernel probably isn't going to get you very far.
100MB is actually usually way more than people need. I would do enough du -sh
invocations so you can see what's taking up all that space, because you shouldn't even be getting kind of close to using 100MB on that mount point:
[root@ditirlns01 ~]# df -h /boot
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 99M 34M 60M 37% /boot
Which is with three kernels installed:
[root@ditirlns01 ~]# rpm -qa kernel*
kernel-xen-2.6.18-348.16.1.el5
kernel-xen-2.6.18-348.4.1.el5
kernel-headers-2.6.18-348.16.1.el5
kernel-xen-2.6.18-308.8.1.el5
[root@ditirlns01 ~]#
I'm willing to wager that someone put a file on /boot
as a temporary move and forgot to move it back off later on.