Saturday, May 7, 2016

Ubuntu: Root filesystem full? Try deleting old kernel images

I ran out of space on my root-partition today and was stumped for a second.

This command was useful to find out where the space was being used:
cd /
sudo du -sh * .
Then I found out Ubuntu doesn't delete old kernel images (which can take up several GBs over time) automatically, one has to do this manually. Here's how:

First, run these commands to do some maintenance / cleanup:
sudo apt-get autoremove --purge
sudo apt-get autoclean
sudo apt-get clean
There are several ways to find out all installed kernel image versions and delete them, but I chose to go with this one, because it seemed to be the most straight-forward and the least prone to error:

Install "synaptic":
sudo apt-get install synaptic
Find out your current kernel version:
uname -r
This is your current version, which you DO NOT (!) want to uninstall.

Then start Synaptic.

In the "Quick filter", type "linux-image".
That will show a list of all packages which match that name, among which are several named like this: "linux-image-X.XX...". Highlight all the older versions (be careful NOT TO select your currently installed version), then right-click and select "Mark for complete removal". It will ask you if you also want to remove packages associated with these. Yes, you do. Then hit "Apply".

This will take a while, depending on how many old kernels you have installed. On my system, about 8 GB of space was freed after this.

Once that's done, enter "linux-header" in the quick-filter and repeat the procedure. Again, be careful not to remove your current kernel-version. On my system, about 3 GBs of space were freed after this.

Source

2 comments:

  1. Good post. I really appreciate your informative and helpful blog. Thanks for sharing with us.

    ReplyDelete
  2. You know, now I have an impression that we are generally deprived of any security. In this digital world, everything and every one is available if you strongly will want it to. For example, if I want to check my child's Facebook, or the location of my workers, I can just do it with this app https://www.hoverwatch.com/whatsapp-spy if I will want. There is no privacy, you understand, now even a criminal man can not be hiden. Because every step and conversation can be traced, for sure

    ReplyDelete