To begin I will mention the history of how the problem happened and then how to solve it.
My team is a Sony Vaio m120AL netbook that I have for about 3 long years with a 320 GB hard drive where they coexist Windows 7, Chakra , my work partition with Xubuntu 12.04, the swap partition, the / home partition and an additional information partition with which I share information with Windows.
For these reasons my root partitions on both systems are considerably small by most standards (around 6GB each) but they have never given me a problem as they are more than enough for all the packages I need.
Now, entering the specific situation, a few days ago applying some updates in Xubuntu (among which a new Kernel was included) I see that the update manager shows an error saying that it is trying to install linux-image-3.2.0-51-generic but that its dependency linux-headers-3.2.0-51 it will not be installed, I review the error in detail and I notice that dpkg complains that there is no space available.
The error said something of this style, although not identical because I did not write it down:
could not create `/usr/src/linux-headers-3.2.0-43/arch/xtensa/include/asm/coprocessor.h.dpkg-new '(while processing` ./usr/src/linux-headers -3.2.0-43 / arch / xtensa / include / asm / coprocessor.h '): No space left on device
On some previous occasion the same thing happened to me but it had been because I had allowed several old Kernels to accumulate without deleting them, but this time I check and have practically 600 Mb available according to Conky from what I do not understand, but to confirm if it may be an error in how I had configured it or similar I run a df -h:
So I am not mistaken and that is more than enough space to perform the update (I have done it this way many times in the long year since I have been with Xubuntu) anyway I do a sudo apt-get clean to clean the packages that I have downloaded and try again, but with the same results.
I still find it strange but anyway I try to move out of / the icon themes that I always use and have modified a lot (Faenza y awoken) to free up more space, and thus I finally manage to perform the update, proceeding again to return them to /.
However, the idea remained in my head that the matter had to go elsewhere but I didn't know which one. A few hours later when I try to install some extra packages I get the aforementioned error again, and once again there was enough space to spare, so I dedicate myself to investigate.
An internet search leads me to several threads on the forums of ubuntu-is, but the answer of some individuals there is always the same: you do not have enough space delete files or expand the root partition, but I noticed something in common in the different threads that I found, always the root partition that had free space, but It was similar to mine (~ 600-900 Mb) and the size of the partition never exceeded 10 Gb so I finished convincing myself that the problem had to be another, and this is how I got to the title of the post thanks to this page, the problem is that the root partition had 100% of the inodes used.
The use of inodes can be seen with the command df -i:
And now comes the explanation.
The inodes are in the word of Dennis Ritchie:
An index, due to the somewhat unusual structure of a filesystem that stored the access information to the files as a flat list on disk, leaving aside all the hierarchical information of the directories
and therefore it may happen that for a given file system there is still free space to store files, but there are no inodes available to index them because there are many files in the system and therefore new ones cannot be created.
The point is that the number of inodes in a partition EXT4 cannot be modified (there are other types of systems such as Jfx o XFS where this is not a limitation because it is dynamic) it is a fixed number that is calculated when the partition is created with mkfs.ext4 according to its size with a ratio of bytes per inode according to the preferences located in /etc/mke2fs.conf.
When installing the system, it is usual to use the default preferences that include an inode = 16384 relation, which for small partitions could be too large and not create enough (as in my case). The only way to change it is by creating / formatting the partition and specifying it with the option -i.
However this was not an option for me, as I already mentioned the inodes are related to the number of existing files, so I used the following bash script found in stackoverflow and that it is linked on the page you mentioned before to find which were the directories in the root partition with more files:
#!/bin/bash
# count_em - count files in all subdirectories under current directory.
echo 'echo $(ls -a "$1" | wc -l) $1' >/tmp/count_em_$$
chmod 700 /tmp/count_em_$$
find . -mount -type d -print0 | xargs -0 -n1 /tmp/count_em_$$ | sort -n
rm -f /tmp/count_em_$$
Which gives the following result:
The number that appears on the left indicates the number of files present and the path indicates the associated directory, one line below appears the directory / var / lib / dpkg / info but as always I purge my packages here there is nothing to do .
However, if I recognize two problems, the first and although in the catpura it does not go up from there several more entries include the icons awoken, so I have to move them yes or yes, also that explains why when I did I could update the packages, since I freed many inodes from the root partition when I moved them, but the problem returned when I relocated them.
And second, the next greater number of entries is associated with the headers of several old kernels, and I realize that the procedure that I always use to eliminate the old kernels does not eliminate the headers, what I usually use is the following, in a terminal I write :
dpkg --get-selections | grep linux-image
which shows me the kernels installed and then I use:
sudo apt-get purge package
Where package is the name of the kernel in question, but this doesn't remove the associated headers so I do a:
dpkg --get-selections | grep linux
And then I proceed to remove the old headers, with:
sudo apt-get purge linux-headers-3.2.0-41 linux-headers-3.2.0-44 linux-headers-3.2.0-45 linux-headers-3.2.0-48
And voilà , but of course there was also the issue of icons awoken so I decide to move them to ~ / .icons and to make them available for the whole system I just make a symbolic link in / usr / share / icons, the first result of df -i It is with the elimination of the headers and the second after having moved the icons.
With this the problem is solved, and I can install / update packages without problem, I hope this post will be of help to someone, or serve for future reference on installations in small partitions and demystify the topic so spread by the forums of the lack Of space.