If you have every had a server online for some time. You’ve probably updated it a couple of times and maybe noticed that the old kernels stay loaded in /boot partition. Well eventually you will run out of space in your /boot partition and need to clear out those old kernels.
Don’t just take my word for it, take a look yourself and to see how many old kernels you have by running the following command (excluding current kernel of course).
[crayon attributes]
dpkg -l ‘linux-*’ | sed ‘/^ii/!d;/'”$(uname -r | sed “s/\(.*\)-\([^0-9]\+\)/\1/”)”‘/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d’
[/crayon]
As you can see there are a couple old kernels stored in your /boot. So how do you get rid of them and free up a little space, same command as above just adding on apt-get purge.
[crayon attributes]
dpkg -l ‘linux-*’ | sed ‘/^ii/!d;/'”$(uname -r | sed “s/\(.*\)-\([^0-9]\+\)/\1/”)”‘/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d’ | xargs sudo apt-get -y purge
[/crayon]
Now you’ve freed up some space in your /boot partition and should be good to go for some more wonderful updates!
Leave a Reply