On Linux and other Unix-like operating systems, an inode stores information that describes a file or directory (also a file – because everything is a file in Unix) except its name and content or its actual data. Therefore, each file is indexed by an inode which is metadata about the file.
An inode contains information such as the physical location of the file, the size of the file, the file’s owner and group, the file’s access permissions (read, write and execute), timestamps, as well as a counter indicating the number of hard links pointing to the file.
Why is it important to keep an eye on inodes?
One of the possible ways in which a filesystem can run out of space is when all the inodes are used up. This can happen even when there is enough free space on disk; consumption of all inodes in the filesystem can block the creation of new files. Besides, it can result in a sudden stop of the system.
To get the number of inodes of files in a directory, for example, the root directory, open a terminal window and run the following ls command, where the -l
option means long listing format, -a
means all files and -i
mean to print the index number of each file.
$ ls -lai /
To get the total number of inodes in the root directory, run the following du command.
$ sudo du --inode /
To list statistics about inode usage (amount available, amount used and amount free and use percentage) in the root partition, use the df commands as follows (the -h
flag allows for showing information in a human-readable format).
$ sudo df -ih/
For a detailed inode definition, read the Linux Information Project article: http://www.linfo.org/inode.html.
sudo df -i / NOT sudo df -ih/
How to increase inode if it full and their is enough hard disk space.
@Arjun,
Check this article: How to Increase Disk Inode Number in Linux.
[~] martin@www% (108) sudo du –inode /
du: unrecognized option ‘–inode’
Try `du –help’ for more information.
@Martin
The correct option is
--inode
not-node
. Check the man page.