inode related question

Now we have started the Linux Sytem Admin questions on daily basis, so that you can check the questions with the answer daily at least one topic. Today’s topic is inode. The following questions are mostly asked  by any institution or company.

1st) What is inode?

Ans ) Al the files and directory having its own description stored in a structure its called as ‘inode’ and every file/directory having differeny inode number. The following fields are content in the inode.

owner identifier
The file type
The file access permissions
Th file access times
The number of links
The most important the file size
The location of the file data

2nd) How to check the inode number for file or directory?

Ans) Refer the following command

For example for file

root@linux [/home]# ll -li test.php
3473411 -rw-r–r– 1 root root 65 Jul 3 15:06 test.php

The inode number for test.php file is 3473411

For example for directory

root@linux[~]# ll -id /root
224001 drwxr-x— 16 root root 4096 Sep 6 04:58 /root/

The inode number for root directory is 224001 

3rd) How to check the server partitions inode numbers/

Ans) We can check the server partitions inode number by using the following command “df -i”

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Filesystem       Inodes           IUsed               IFree                    IUse%    Mounted on
/dev/sda1       1280000      10131               1269869             1 2%         /home
/dev/sda3      6403712       111265             6292447             2%            /usr
/dev/sda2      6403712       27690             6376022             1%             /var
/dev/sda6      512512          4333                 508179                1%             /tmp

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

4th) Can two files have the same inode number?

Ans) If files are present on two different partitions than only files can have same inode number else on same partiton two files with the same inode number is not possible.
5th) How to check how many inode are free on the server?
Ans:) We can use the following command to check the free and used inodes on the server.

df -i

We will update more question in future for inodes issue

 

About Anant 384 Articles
Senior technical writer