How to view total and free inodes of a filesystem in Linux ?

I hope you must be aware of what inodes are and what happens if there are no free inodes available on the system ?

Today we will check how can we check the total available inodes on a filesystem and how many indoes are free on Linux system.

So here comes the easiest and simplest way:

1. Using stat command to check inode status.

[root@nglinux ~]# stat -f /dev/sda1
  File: "/dev/sda1"
    ID: 0        Namelen: 255     Type: tmpfs
Block size: 4096       Fundamental block size: 4096
Blocks: Total: 125679     Free: 125625     Available: 125625
Inodes: Total: 125679     Free: 125002
[root@nglinux ~]# 

2. Another easy way is to use df command with “-i” option to view the inode status.

[root@nglinux ~]# df -i /dev/sda1
Filesystem      Inodes  IUsed   IFree IUse% Mounted on
/dev/sda1      1310720 164295 1146425   13% /
[root@nglinux ~]# 

3. To see all details related to inodes, we can use tune2fs command like below:

[root@nglinux ~]# tune2fs -l /dev/sda1 | grep -i inode
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
Inode count:              1310720
Free inodes:              1163018
Inodes per group:         8192
Inode blocks per group:   512
First inode:              11
Inode size:	          256
Journal inode:            8
First orphan inode:       928882
Journal backup:           inode blocks
[root@nglinux ~]# 

I hope you liked the article, please do reply/comment here or subscribe to our blog to stay updated.

5 1 vote
Article Rating
Notify of

1 Comment
Oldest Most Voted
Inline Feedbacks
View all comments
2 years ago

Note that the first example is one.
“stat -f” should be run on the mount point not the device.
The data “stat -f” shows in the example is for the /dev tmpfs