Published by expire0
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.
Example
df
/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 ‘http://skvidal.fedorapeople.org/misc/kernel-prune.py’
You will then need to make the python script executable by issuing
chmod a+x kernel-prune.py
Then running it using ./kernel-prune.py
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
PKGS=`./kernel-prune.py`
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.
Thanks,