Operating System - Linux
1752565 Members
5318 Online
108788 Solutions
New Discussion юеВ

Re: Inodes in 'df -i' and /proc/sys/fs/inode-nr

 
SOLVED
Go to solution
Michael Steele_2
Honored Contributor

Inodes in 'df -i' and /proc/sys/fs/inode-nr

*********/proc/sys/fs/inode-nr
ALLOCATED FREE
INODES INODES

64689 256

********* df -i
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sda1 856480 109553 746927 13% /
none 209419 1 209418 1% /dev/shm
/dev/sda5 146592 502 146090 1% /tmp
/dev/sda3 292608 857 291751 1% /var
/dev/sda6 147744 27 147717 1% /var/tmp
rcdn9-9u-filer01a:/vol/dfs1/usrcisco-linux-x86/usrcisco-linux-rhel3.0-x86-32
8800918 498125 8302793 6% /auto/usrcisco-linux-rhel3.0-x86-32
rcdn9-40b-filer14b:/vol/local3/apollo_dev1_opt
30515486 1 30515485 1% /apps

Hi:

I'm investigating inodes and max-inodes and getting some conflicting info.

Tell what I should know about red hat 2.6 inodes, in 5.1.

Question: There is no longer a /proc/sys/fs/inode-max value, but you still have to mkfs -i number of inodes in a file system. What's up ?
Support Fatherhood - Stop Family Law
5 REPLIES 5
macosta
Trusted Contributor

Re: Inodes in 'df -i' and /proc/sys/fs/inode-nr

I can't answer your question directly, (check the Linux kernel mailing list archives for some [maybe] discussion on this matter,) but not all filesystems have to worry about pre-allocated inodes. For example, Reiser3 has no pre-defined limit - it's based on the free number of blocks. Any filesystem modeled after the UFS model (such as ext2/ext3) may need to take this into consideration.

What problem are you trying to solve, if any? If none, are you just looking for clarification?
Matti_Kurkela
Honored Contributor
Solution

Re: Inodes in 'df -i' and /proc/sys/fs/inode-nr

/proc/sys/fs/inode-* files are all about the kernel's inode structures _in RAM_. This used to be tuned manually, but now it's managed automatically. As far as I see, it's kind of like "ninode" in HP-UX with HFS filesystems.

mkfs -i deals with inodes _on disk_, in the filesystem. In ext2/ext3 filesystems, you decide at filesystem creation time how many inodes you're going to allocate per unit of disk space. Once the filesystem is in use, this ratio is set in stone: you can only add inodes to an existing filesystem by extending it.

All the files in /proc/sys are various kernel-level parameters, collectively known as "sysctls". Some can be adjusted at run-time, others are read-only. The read-only sysctls allow the kernel developers (and sysadmins, if so inclined) to easily monitor some parameters related to kernel's internal workings.

For more information, install the kernel-doc package and look into /usr/share/doc/kernel-doc-/Documentation/sysctl/ directory. Within that directory, a file called "fs.txt" describes the files in /proc/sys/fs/ directory.

MK
MK
Michael Steele_2
Honored Contributor

Re: Inodes in 'df -i' and /proc/sys/fs/inode-nr

Macosta:

Not using Reiser. Using standard ext2 and ext3.

"...it's based on the free number of blocks...."

Yes, this is what I reading from the man pages. But the documentation doesn't seem up to date since I've seen internet procedures on changing "..inode-max..." in /proc/sys/fs. And the man pages specify "...Be warned that is not possible to expand the number of inodes on a filesystem after it is created...".

Comments Please?

Question: Given that the man pages also state "...mke2fs creates an inode for every bytes-per-inode bytes of space on the disk....", when using the "...-i bytes-per-inode..." option, what is the value to use here. Note: The man pages also state "...This value shouldn't be smaller than the block size...". (* Typical block size is 4096, so what value is typically used here? *)

Question: Does this apply for ext2 only or does ext3 also have this option?

Given: Man page for mke2fs, -N number-of-inodes

Question: Is this an obsolete option?

Matt:

Thanks very much. You're really hitting close to the mark. "... Once the filesystem is in use, this ratio is set in stone: you can only add inodes to an existing filesystem by extending it...."

That's what I'm looking for.

So, if you run out of inodes:

a) do you prune the Linux Inode table
b) expand the file system

Question: Thanks very much for the doc. But it seems out of date. It makes references to 'inode-max' under /proc/sys/fs and this is what set me on this posting in the first place. Its not there. Is it obsolete at Red Hat 5.1? Or is it a transient file that I should be looking for? (* There are hundreds of linux boxes over here. I'm traditionally an HP-UX admin and tranistioning over *)
Support Fatherhood - Stop Family Law
Michael Steele_2
Honored Contributor

Re: Inodes in 'df -i' and /proc/sys/fs/inode-nr

One final question: I really don't see the relationship between 'df -i' inode report and /proc/sys/inode-nr.

Can someone explain this?
Support Fatherhood - Stop Family Law
Randy Jones_3
Trusted Contributor

Re: Inodes in 'df -i' and /proc/sys/fs/inode-nr

As Matti pointed out, there is no relationship between the inode counts in your file systems and the /proc/sys/fs/inode-nr values. The numbers in inode-nr track the state of the kernel's inode cache.

/proc/sys/fs/inode-max was dropped as of kernel 2.4.18 (see http://lkml.indiana.edu/hypermail/linux/kernel/0203.3/0211.html), when it was converted from static to dynamic (see http://lkml.indiana.edu/hypermail/linux/kernel/9909.1/0917.html). That would be way back around Red Hat 7.3.

If you run out of inodes you will need to either extend or recreate an ext2/3 file system.