Cleaning the /boot Partition on Linux

Published by

Posted on July 11, 2010

Over time after doing multiple Kernel updates and security patches. You will notice the /boot partition is getting full to about 90% when doing a df command.

/dev/sda34 124427 12078 105925 11% /boot

Is this case I am only using 11% of my boot after cleaning up the unused kernel images.

The Fedora Community has released a Open Source script under the GNU Licensing called Kernel-prune . you can download this script using the following command via ssh

curl -O ‘’

You will then need to make the python script executable by issuing
chmod a+x

Then running it using ./
The return value will give you a list of unused kernel images which can be safely removed from your system.

To remove the kernels I created a file called cleanboot and added the following content
echo $PKGS
yum remove $PKGS

Again making this new file executable using
chmod a+x cleanboot

Then running the file as ./cleanboot

The script will ask you if you would like to remove the unused kernel packages , hit Y for yes and give it a few moments. Perform a reboot and you should be all set.

This script may work on centos and other distros , but i have not tested this solution on those systems. Please make a backup of your data before proceeding with this process.