Linux 101 : Troubleshooting disk not full, "Error : no space left on device" - inodes -

When we get greeted by the message: no space left on device. Our first thought is to remove some files to free up space on the hard drive.
We run the below command to see which filesystem is full:

And we find out that the none of the filesystems is not full and that we still have a lot of free space.


Inodes are objects that contain information about every file object on the filesystem. 
Inodes are a limited resource, and once this resource runs out, we receive the error "no space left on device" even if our disk still have plenty of free space.

All the file types on a system (files, directories, sockets, ...) have an inode referencing them.
We can check the percentage of used inodes using the below command:

When the number gets higher in the IUse% column, we could run the below commands to see which directory has a big number of inodes , for example for the /usr directory, we would use:

The command searches the current directory for the type "file" and sorts out the output numerically.
If we want the inodes related to directories, we use "-type d", and for symbolic links we use the "-type l".
We see that the share directory uses the highest number of inodes.

We repeat the same process for each directory of the filesystem, "/home", "/etc", ..., then we can decide what to do, for example deleting the old files.


Leave as a comment: