clean: linux BOOT partition from unused kernels

From CCIE networking & linux
Jump to: navigation, search

I am facing the issue having full /BOOT partition. What to do? Easiest way is to remove unused linux kernels.

Boot1.png

To display all possible kernels (excluding running one) I use this command:

kernelver=$(uname -r | sed -r 's/-[a-z]+//')
dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve $kernelver

the output would be:

Boot2.png

Command to remove the kernels: Manually

sudo apt-get purge linux-image-3.2.0-48-generic linux-image-3.2.0-49-generic linux-image-3.2.0-51-generic 

Or with one command!

sudo apt-get purge $(dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve "$(uname -r | sed -r 's/-[a-z]+//')")


Result display with command #df -h

Boot3.png

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox
Offer
Martin Satara