How to: Get the Inode utilization data of a filesystem using df command

When we talk about a file in ex2/3/4 filesystems, it consists of two kinds of information - filename and inode. The latter is a special data structure to store information about the file - file type, size, ownership, access information(read,write,execute bits), location of the file content etc. Such type of information is also known as metadata.

An important thing to note is that inode doesn’t contain the content/data of a file. It only points to the location. Another interesting thing about them is that, they are not created on the fly. A fixed number of inodes is already made whenever a new file system is created. This number denotes the maximum number of files that can be supported by the filesystem, not the size/amount of data.

We can find the total number of inodes for a filesytem, both consumed and free ones using the df command.

This command is used to provide information regarding filesystem utilization. Using its “-i” argument, we can view all the information related to inodes.

[shredder12]$ df -i

/dev/sda2             917504  353597  563907   39% /
none                  212507     833  211674    1% /dev
none                  216609      32  216577    1% /dev/shm
none                  216609      88  216521    1% /var/run
none                  216609       4  216605    1% /var/lock
/dev/sda5            6291456  102799 6188657    2% /home

As you can see 39% of Inodes are used up in the "/" partition. This is because there are a lot of small files e.g - /usr/share/doc contains tons of files. If you notice, this is not the case with the /home directory. It actually consumes 9 times more space than the "/" partition but utilizes only 1/16th as compare to it.

[shredder12]$ df -h

/dev/sda2              14G  8.7G  4.5G  67% /
none                  1.3G  276K  1.3G   1% /dev
none                  1.3G  8.2M  1.3G   1% /dev/shm
none                  1.3G  296K  1.3G   1% /var/run
none                  1.3G     0  1.3G   0% /var/lock
/dev/sda5              95G   79G   12G  88% /home

1 Comment

Rahul Janghel (not verified)
April 9th, 2011 06:24 am
What about distribution of Inodes within a filesystem to different mount points, how this gets calculate ?

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <img> <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote> <h1> <h2> <h3> <h4> <h5> <h6> <p> <br>
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Image links with 'rel="lightbox"' in the <a> tag will appear in a Lightbox when clicked on.

More information about formatting options

Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.