title: How inode number is distributed in a linux root filesystem?
body: <p>I have several questions on how inode number is used in linux filesystem. These questions may be related but for clearness I will ask them one by one.</p>
  
  <p>Q1: Take EXT2/3 for example, from "<a href="http://e2fsprogs.sourceforge.net/ext2intro.html" rel="nofollow">Design and Implementation of the Second Extended Filesystem</a>" I know that there are inode tables in block groups, and I know inode presents file, but what if there are too many files but the inode numbers are not enough?
  My best guess is that filesystem does nothing if all its inode numbers were exhausted. And if some file get deleted later, its inode may be recycled.</p>
  
  <p>Q2: I run "df -i" on my Linux server and I get this:</p>
  
  <pre><code>Filesystem            Inodes       IUsed   IFree      IUse% Mounted on    
      /dev/sda1          1313280    7853 1305427    1%     /
      devtmpfs                   0       0       0              -       /dev
      tmpfs                 525298       4  525294        1%    /dev/shm
      /dev/sda2              65808      50   65758       1%    /boot
      /dev/sda5            1313280     146 1313134    1%   /opt
      /dev/sda6             655776      37  655739      1%   /tmp
      /dev/sda7             655776    5219  650557    1%   /home
      /dev/sda8            1313280     840 1312440    1%  /var
      /dev/sda9             655776   36529  619247    6%  /usr
      /dev/sda10              6432      11    6421        1%  /crash
      /dev/sda12            135488      11  135477     1%  /usr/local/instances
      tmpfs                 525298       3  525295    1% /var/run/xenstored
      tmpfs                 525298       3  525295    1% /var/lib/xenstored
      tmpfs                 525298       3  525295    1% /var/lib/xend/socket
      tmpfs                 517536       3  517533    1% /var/run/libvirt/socket
  </code></pre>
  
  <p>I see that each filesystem has its own inode counts and these filesystems (like devtmpfs and tmpfs) are all mounted to <a href="http://www.linfo.org/root_filesystem.html" rel="nofollow">root file system</a>. I guess each filesystem have their own inode tables, but are inode numbers of different filesystems distributed in different ranges, like root filesystem is [0, N] and tmpfs is [N+1, M]?</p>
  
  <p>If inode numbers of different filesystems are in different ranges (which I don't think so), how filesystems make an agreement on range division?</p>
  
  <p>If inode numbers of different filesystems are generated based on the same rule (like all start from 0), can different filesystems conflict if we mount them together? As I know, inode presents files in running OS, what the OS will do if a file in root filesystem has inode number N and another file in another filesystem (like tmpfs) also has the inode number N?</p>
  
  <p>PS. I'm kind of new to Linux and I'm not coming from a English-speaking country, sorry for if I didnot make clear expression. Thanks in advance.</p>