How to calculate the inodes number shown by the command “df -i” command line in comparison with “df -k”?

book

Article ID: 100004248

calendar_today

Updated On:

Description

Error Message

Fri Dec 17 12:13:13 EST 2010
MemTotal:     36911904 kB
MemFree:       7288840 kB
SwapCached:         56 kB
SwapTotal:    30194288 kB
SwapFree:     30194172 kB
Dirty:           73504 kB
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/vx/dsk/datadg/datavol
                     419338112 419313522     24071 100% /app         <<<<<<<<<<< 100%
15K     /app/gccg/gateway/batch
388G    /app/gccg/gateway/data
1.7M    /app/gccg/gateway/cf
44K     /app/gccg/gateway/html
427K    /app/gccg/gateway/javalib
13G     /app/gccg/gateway/log
33K     /app/gccg/gateway/scripts
9.0K    /app/gccg/gateway/tmp
49K     /app/gccg/gateway/db
53M     /app/gccg/gateway/bin
97K     /app/gccg/gateway/backup
400G    /app/gccg/gateway
400G    /app/gccg
Filesystem            Inodes   IUsed   IFree IUse% Mounted on
                       10196    4121    6075   41% /app                             <<<<<<<<< 41%

Cause

1. The number of inode shown by VxFS is only an estimation.
2. The VxFS ilist is dynamically grown and is not fixed.
3. For more explationation in detail, please refer to the following link;
TECH60940 - The estimated size of the inode list is deducted from the available space reported by df command on Veritas File System (VxFS)

https://www.veritas.com/support/en_US/article.TECH60940

Resolution

 

1. Checking the inodes status and its allocated space, /tfs while making this file system full ( by conducting, #cp /etc/*  /tfs )
 
[hpux2_v3:/tfs]while [ 1 ]
> do
> echo "----------------------------------------------"
> df -i /tfs
> df -k /tfs
> sleep 5
> done
----------------------------------------------
/tfs                   (/dev/vx/dsk/tdg/tvol  ) :   247964 total i-nodes                 <<<<<<<<<
                                                    247732 free i-nodes
                                                       232 used i-nodes
                                                         0 % i-nodes used
/tfs                   (/dev/vx/dsk/tdg/tvol  ) :   986721 total allocated Kb
                                                    929088 free allocated Kb
                                                     57633 used allocated Kb
                                                         6 % allocation used
..
..
----------------------------------------------
/tfs                   (/dev/vx/dsk/tdg/tvol  ) :   121756 total i-nodes
                                                    121523 free i-nodes
                                                       233 used i-nodes
                                                         0 % i-nodes used
/tfs                   (/dev/vx/dsk/tdg/tvol  ) :  1018273 total allocated Kb
                                                    455800 free allocated Kb
                                                    562473 used allocated Kb
                                                        56 % allocation used
..
..
----------------------------------------------
/tfs                   (/dev/vx/dsk/tdg/tvol  ) :      544 total i-nodes
                                                       312 free i-nodes
                                                       232 used i-nodes
                                                        42 % i-nodes used
/tfs                   (/dev/vx/dsk/tdg/tvol  ) :  1048576 total allocated Kb
                                                         0 free allocated Kb
                                                   1048576 used allocated Kb
                                                       100 % allocation used
 
 
2.  At this time, we can see that there are an allocated size for these inode number, size 139264
[ Note that these number is affected when the file system becomes full ]
 
[hpux2_v3:/]fsdb -F vxfs  /dev/vx/rdsk/tdg/tvol
> 1fset.65i
inode structure at 0x00000018.0100
type IFILT mode 4000000777  nlink 1  uid 0  gid 0  size 139264
atime 1212221602 978860  (Sat May 31 17:13:22 2008 KST)
mtime 1212221602 978860  (Sat May 31 17:13:22 2008 KST)
ctime 1212221602 978860  (Sat May 31 17:13:22 2008 KST)
aflags 0 orgtype 1 eopflags 0 eopdata 0
fixextsize/fsindex 999  rdev/reserve/dotdot/matchino 97
blocks 136  gen 15483  version 0 2   iattrino 0
dotdot 0  inattrino 0
de:  16936 20096     0     0     0     0     0     0     0     0
des:     8   128     0     0     0     0     0     0     0     0
ie:      0     0
ies:     0
 
[hpux2_v3:/]bc
139264 / 256
544               <<<<< This is the number of Total inodes ( left when the file system become full )
 
 
So therefore, we can still use 312 numbers of inodes in free inode.
Which means, even if the practical file system become full, we still can use the extent inode space as it does not reach its maximum number, irrespective of the full file system, 100%
 
[hpux2_v3:/tfs]df -i /tfs;df -k /tfs
/tfs                   (/dev/vx/dsk/tdg/tvol  ) :      544 total i-nodes
                                                       312 free i-nodes
                                                       232 used i-nodes
                                                        42 % i-nodes used
/tfs                   (/dev/vx/dsk/tdg/tvol  ) :  1048576 total allocated Kb
                                                         0 free allocated Kb
                                                   1048576 used allocated Kb
                                                       100 % allocation used
 
[hpux2_v3:/tfs]touch 1
[hpux2_v3:/tfs]touch 2
[hpux2_v3:/tfs]touch 3
[hpux2_v3:/tfs]touch 4
[hpux2_v3:/tfs]touch 5
 
[hpux2_v3:/tfs]df -i /tfs;df -k /tfs
/tfs                   (/dev/vx/dsk/tdg/tvol  ) :      544 total i-nodes
                                                       307 free i-nodes                                       << This amount is deducted from 312 to 307 as there was 5 number in use.
                                                       237 used i-nodes
                                                        43 % i-nodes used
/tfs                   (/dev/vx/dsk/tdg/tvol  ) :  1048576 total allocated Kb
                                                         0 free allocated Kb
                                                   1048576 used allocated Kb
                                                       100 % allocation used
 
 
[hpux2_v3:/tfs]rm 1 2 3 4 5
 
[hpux2_v3:/tfs]df -i /tfs;df -k /tfs
/tfs                   (/dev/vx/dsk/tdg/tvol  ) :      544 total i-nodes
                                                       312 free i-nodes                                     << This amount gets back from 307 to 312 as there was 5 number in re-allocation.
                                                       232 used i-nodes
                                                        42 % i-nodes used
/tfs                   (/dev/vx/dsk/tdg/tvol  ) :  1048576 total allocated Kb
                                                         0 free allocated Kb
                                                   1048576 used allocated Kb
                                                       100 % allocation used
 
[hpux2_v3:/tfs]rm *
 
[hpux2_v3:/tfs]df -i /tfs;df -k /tfs
/tfs                   (/dev/vx/dsk/tdg/tvol  ) :   257676 total i-nodes
                                                    257673 free i-nodes                                 << This amount gets back from 312 to 257673 as there was a number of files in re-allocation.
                                                         3 used i-nodes
                                                         0 % i-nodes used
/tfs                   (/dev/vx/dsk/tdg/tvol  ) :   984293 total allocated Kb
                                                    966411 free allocated Kb
                                                     17882 used allocated Kb
                                                          2 % allocation used
 
 
[ Comment ] The number of inode shown by VxFS is only an estimation.    The VxFS ilist is dynamically grown and is not fixed.   The following article describes how VXFS estimates the total number of inodes.
000034076 - The estimated size of the inode list is deducted from the available space reported by df command on Veritas File System (VxFS)
 
 
3.  At this time, we also see that there are an allocated size for these inode number, size 139264
 [ Note that this is a test for affected inode numbers when the file system does not become full ]
 
[hpux2_v3:/tfs]cp /etc/* /tfs
 
[hpux2_v3:/tfs]df -i /tfs;df -k /tfs
/tfs                   (/dev/vx/dsk/tdg/tvol  ) :   247964 total i-nodes     
                                                    247733 free i-nodes
                                                       231 used i-nodes
                                                         0 % i-nodes used
/tfs                   (/dev/vx/dsk/tdg/tvol  ) :   986721 total allocated Kb
                                                    929088 free allocated Kb
                                                     57633 used allocated Kb
                                                         6 % allocation used
 
[ Comment ] The output above shows that the amount number of inodes keeping with the usage of files or directories in its changes corresponding to the space of total allocation.
 

 

Issue/Introduction

Why contents are not full capacity in inodes when disk blocks goes up to 100%?
[ Please note that this will provide the practical way to see how inodes correlates with blocks and allocated space in file system with examples ]