Freeing Up Space on Ubuntu When You Unexpectedly Run Out of Disk Space

Recently, whilst working on an open-source project I work on we found ourselves running out of space on the server. The weird thing is the projects on the server themselves were barely 100mb in total file size, but we had run out nonetheless.

After a little investigation to see what is using up the majority of space, the search led to the /usr/src folder which contains source header files for Ubuntu’s APT package manager. A trove of files in here weighing around 100mb seemed to add up to 4 gigabytes of used space.

While it might be tempting to delete these, you shouldn’t touch this folder manually. Using sudo apt-get autoremove the package manager will cleanup unneeded source files in this folder. In this instance, it resulted in 4 gigabytes freed up.

Leave a Reply

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