# Ubuntu – /usr/src is eating up all inodes

12.04inodekernel

It seems /usr/src (apparently old kernels) used up all my inodes:

Filesystem             Inodes  IUsed     IFree IUse% Mounted on
/dev/sda4              489600   489600       0  100% /
devtmpfs               219658      539  219119    1% /dev
none                   219844      474  219370    1% /run
none                   219844        3  219841    1% /run/lock
none                   219844        8  219836    1% /run/shm
/dev/sda6             5963776     8361 5955415    1% /home


I tried everything to remove/purge, etc. the old kernels, without success.
dpkg is not working anymore. I tried a few manual commands, but 12.04 gives me nothing. apt-get, etc. is not possible due to lack of space on the hard drive, which is not the problem obviously. However I cannot install or remove anything!
I read a lot about users with the same problem, but their solutions are not working for me.

• 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}