When I remotely logged in to a server I maintained, I was alarmed by this message:
/boot is using 87.7% of 227MB
It's kind of "something" that you'll get yourself to worry because it may have some adverse effect into your server. So then, I googled and found out some potential solutions, the best one I found
here. From the previous threads I read, this problem usually occurs when after you updated your server's kernel you still keep the old versions. And if you repeatedly do this, you will eventually run out of space in
/boot.
The key idea is, after you install a new kernel you have to remove the old one. But you only do this after you have tested the new kernel and everything works fine with it.
So, here are the things you need to do in removing the old kernels using a command line. (Synaptic has alternative of doing this via GUI)
Step 1. Paste this code into your
.bashrc file.
rmkernel () {
local cur_kernel=$(uname -r|sed 's/-*[a-z]//g'|sed 's/-386//g')
local kernel_pkg="linux-(image|headers|ubuntu-modules|restricted-modules)"
local meta_pkg="${kernel_pkg}-(generic|i386|server|common|rt|xen|ec2)"
sudo aptitude purge $(dpkg -l | egrep $kernel_pkg | egrep -v "${cur_kernel}|${meta_pkg}" | awk '{print $2}')
}
Step 2. Run
source .bashrc
Step 3. Then
rmkernel
After Step 3, you will be prompted to enter the admin password and it will list the kernels installed in your system, mine looks like this:
The following packages will be REMOVED:
linux-headers-3.0.0-14{pu} linux-headers-3.0.0-14-server{pu} linux-headers-3.0.0-15{pu} linux-headers-3.0.0-15-server{pu}
linux-headers-3.0.0-16{pu} linux-headers-3.0.0-16-server{pu} linux-headers-3.0.0-17{pu} linux-headers-3.0.0-17-server{pu}
linux-headers-3.0.0-19{pu} linux-headers-3.0.0-19-server{pu} linux-headers-3.2.0-24{pu} linux-headers-3.2.0-24-generic{pu}
linux-image-2.6.38-11-server{p} linux-image-2.6.38-12-server{p} linux-image-2.6.38-13-server{p} linux-image-2.6.38-8-server{p}
linux-image-3.0.0-14-server{p} linux-image-3.0.0-15-server{p} linux-image-3.0.0-16-server{p} linux-image-3.0.0-17-server{p}
linux-image-3.0.0-19-server{p} linux-image-3.2.0-24-generic{p}
0 packages upgraded, 0 newly installed, 22 to remove and 43 not upgraded.
Need to get 0 B of archives. After unpacking 1,617 MB will be freed.
Do you want to continue? [Y/n/?] y
After you answered "y"es, more messages to appear on the screen and after that, you will only be left with one kernel in you
/boot. To verify, you can issue this command:
ls -alt /boot/initrd.img* . You should only see one listing, and that is your current kernel.
Fin.