Insights into building a solid I.T. foundation in the mid-size business world.

Clearing space on Linux /boot partition

This is kind of a “101” lesson, but it’s an issue that can really baffle Linux newbies. Ubuntu Linux, when configured to auto-update itself, will update its own kernel. That’s all fine, but the problem is that it retains the old kernel data, which can quickly build up in the standard /boot partition – a partition that is typically not very large.

DriveSlimIcon1Once /boot fills up, the system freaks out and becomes unstable. So, needless to say, it’s important to clear out those old kernel files every once in a while. Here’s how:

First, check to see what version of the Linux kernel is active:

uname -r

Next, do a directory listing of the contents of /boot:

ls -l /boot

You’ll notice that there are multiple files there w/ the same versions – don’t sweat that – the removal process will remove the corresponding files on a per-version basis.

Starting with the OLDEST version, run the following:

sudo apt-get purge linux-image-<oldest version number>

Repeat for each of the old kernels (but be sure not to accidentally attempt to delete the current, live kernel!).

Also, I typically keep the last version, as well – just in case.

Note that there are many tutorials on this topic, some of which provide a huge, complex-looking single line of code to do all of these steps at once. I’m not a big fan of this, as too many things can go wrong. Better to do this one step at a time, IMO.

Leave a Reply

Your email address will not be published. Required fields are marked *