It is been a while since the last time I write a blog post, because i have been quite busy with works and study. I’ve been using Elementary OS more than a year now, since Elementary Luna and now I am using Elementary Freya that based on Ubuntu 14.04 LTS. Just few days ago I got notification that my root partition has only 1GB free space left, from 20GB total space. I was surprised because I didn’t install many thing there, and even my /home directory is on the same partition, but i kept most of the big files on my NTFS partition so it is easier if I am gonna access it from Windows. The only ‘programs’ that actually consume much space is wineprefix directory that contain Microsoft Office 2007, mysql server and mongodb server. From my rough calculation, I should still have at least 5GB free space.
Then i tried to analyze my partition using Disk Usage Analyzer tool called Baobab. To install it simply using this command :
sudo apt-get install baobab
If you’re gonna analyze root (/) partition is better to run baobab as root, because some of the files in root partition not accessed by normal user
The analyze result show that old kernels files is quite big. I don’t think i need to kept this old kernels and I start googling to find quick way to remove the old kernels file. This is the command to remove unused kernels from your Ubuntu based system :
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
Just copy and past that command to your terminal, confirm (if needed) and wait until the purge process finished. After that you’ll be prompted to restart the system to complete the changes, but you always can restart it later if you still need to your computer because right after that purge process, old kernel files is already deleted and You can check root partition free space, and you should get more free space now :-).
If You need explanations of that command, You can check this blog post written by Mark McBride.