/usr/src is eating up all inodes

Try this.

Open a terminal and enter:

~$ cd /usr/src
/usr/src$ ls

You will see something like this:

total 16K
drwxr-xr-x 24 root root 4,0K Σεπ  29 22:35 linux-headers-3.2.0-54/
drwxr-xr-x  7 root root 4,0K Σεπ  29 22:35 linux-headers-3.2.0-54-generic/
drwxr-xr-x  3 root root 4,0K Σεπ  29 22:56 nvidia-319-319.32/

The output may (and will) differ according to your set up.

Take a close look at the folders named linux-headers-*. These are the headers from all your linux images that you have installed. If you have too many of them, they will take up A LOT of space and inodes. You only need to keep the latest one you boot from.

Let's say you have an older kernel, eg. 3.2.0-53. To remove it, type:

sudo apt-get remove --purge linux-image-3.2.0-53-generic linux-headers-3.2.0-53 linux-headers-3.2.0-53-generic

for each one of them.

If all of the above fail, then try to delete the OLDER KERNEL headers' folders manually:

sudo rm -rf /usr/src/linux-headers-3.2.0-53{,-generic}

You can try Ubuntu Tweak to clean old kernels. First install it using these commands

sudo add-apt-repository ppa:tualatrix/ppa
sudo apt-get update
sudo apt-get install ubuntu-tweak

Run the program and then:

  1. Select the "Janitor" tab
  2. Select the "Old Kernel" checkbox
  3. Select kernel versions to remove (keep 2 at leats - just in case)
  4. Press "Clean"

enter image description here


I just had the same issue

On Ubuntu Linux 16.04.1 it seems that sudo apt autoremove will clean up all the unnecessary /usr/src/linux-headers- files and free the corresponding inodes