How to free /boot partition in Linux

I have recently noticed that my /boot partition was full so it didn’t allow me upgrade VMware Agent on Ubuntu Server. I was getting the following error during the VMware Agent installation

Creating a new initrd boot image for the kernel.
No module BusLogic found for kernel 2.6.18-92.el5PAE, aborting.
ERROR: "/sbin/mkinitrd -f --with=vmxnet --with=vmxnet3 --with=pvscsi /boot/initrd-2.6.18-92.el5PAE.img 2.6.18-92.el5PAE" exited with non-zero status.

Your system currently may not have a functioning init image and may not boot properly. DO NOT REBOOT! Please ensure that you have enough free space available in your /boot directory and run this configuration script again.

Execution aborted.

In order to resolve this problem I did following:

  1. Checked space on the Linux server with df -f command, I got got the following output
    /dev/sda1 228M 228M 0M 100% /boot
  2. Then run: dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d'This command will list all the packages which are not longer needed i.e:linux-headers-3.2.0-38
  3. Run: uname -a to check kernel version. On Ubuntu server you should see something similar to: Linux SERVER03 3.2.0-32-generic #51-Ubuntu SMP Wed Sep 26 21:33:09 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
  4. And finally I removed all not needed packages apart the one which corresponds the kernel version, which is in my case 3.2.0-32-generic. I used the following command to remove the packages ver. 3.2.0-18 :
    sudo apt-get -y purge linux-headers-3.2.0-38 linux-headers-3.2.0-38-generic
  5. After I removed all no longer needed packages I checked the size of the /boot partition again with df -h command. Now my /boot partition shows: /dev/sda1 228M 25M 192M 12% /boot

Leave a Reply

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

You are commenting using your 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