Freeing up inodes in linux / Ubuntu

This is a follow up of notes from this post

$ sudo -i #lets make life simple!

First we are going to try and get this done automatically in the furture.

$ dpkg-reconfigure unattended-upgrades

Once set up uncomment the "Remove-Unused-Dependencies" line and set to true

$ nano /etc/apt/apt.conf.d/50unattended-upgrades

i.e. Unattended-Upgrade::Remove-Unused-Dependencies "true";

Manually remove old headers which will free up a massive amount of inodes Make sure you've done everything else first and that you do not remove your current kernel. Actually leave the last 2 to 3 versions there for safety.

# $ cd /usr/src && ls -ls

Once you have a list of headers e.g.

drwxr-xr-x  7 root root 4096 Aug 13 20:42 linux-headers-3.13.0-128-generic  
drwxr-xr-x 24 root root 4096 Aug 13 20:21 linux-headers-3.13.0-128  
drwxr-xr-x  7 root root 4096 Jul 19 19:49 linux-headers-3.13.0-125-generic  
drwxr-xr-x 24 root root 4096 Jul 19 19:49 linux-headers-3.13.0-125  
drwxr-xr-x  7 root root 4096 Jun 20 07:16 linux-headers-3.13.0-121-generic  
drwxr-xr-x 24 root root 4096 Jun 20 07:16 linux-headers-3.13.0-121  
drwxr-xr-x 24 root root 4096 May 17 22:52 linux-headers-3.13.0-119  
drwxr-xr-x  7 root root 4096 Apr 25 06:48 linux-headers-3.13.0-117-generic  
drwxr-xr-x 24 root root 4096 Apr 25 06:48 linux-headers-3.13.0-117  
drwxr-xr-x  7 root root 4096 Mar  8 07:42 linux-headers-3.13.0-112-generic  
drwxr-xr-x 24 root root 4096 Mar  8 07:42 linux-headers-3.13.0-112  

Know that you are on 3.13.0-128-generic you want to run the following command on all but the last 3 headers.

$ apt remove linux-headers-XX.XX.XX-XXX