Ext4 has a theoretical limit of 4 billion files, which is restricted by the size of inode number it uses to identify each file (ext4 uses 32-bit inode numbers). However, as John says, ext4 allocates inode tables statically, so the actual limit is set when the filesystem is created.
The df command shows you a count of free inodes on your filesystem:
$ df -i
Filesystem iused ifree %iused Mounted on
/dev/disk0s3 55253386 66810480 45% /
/dev/disk1s3 55258045 66805821 45% /Volumes/Clone
Ext4 also supports an unlimited number of sub-directories per directory, though it may default to a limit of 64,000. This is configurable -- see the ext4 article at Kernel Newbies.
For more information, see The new ext4 filesystem: current status and future plans from the 2007 Linux Symposium.
After a little more testing, I believe this to be an NFS server bug. When a process on an NFS client places a write lock on a file, the server reserves an open file handle (this may be the wrong terminology -- my apologies to any actual kernel gurus reading this). This would probably be OK if the server released the handle when the lock is released, but it apparently doesn't.
My original problem occurred with rrdtool. rrdtool opens a file for read/write, locks the file for writing, makes its changes, and exits. Each time I run rrdtool, the number of open files on the server increases by one. (Nitpicky detail -- the server actually allocates in chunks of 32, so it's more like "32 runs make 32 open file descriptors", but that's an insignificant detail in the long run)
I wrote a minimal test program to verify this behavior. Indeed, opening the file, locking it, then exiting is sufficient to trigger this. Explicitly releasing the lock before exiting does not help in any way. Opening the file without locking it does not trigger the problem.
So far, I still have not found a way to release the resources on the server, other than rebooting. Restarting the NFS service is insufficient, as noted above.
I still haven't tested NFS version 3. Perhaps it works better.
Anyway, thanks for trying. Hopefully my experiences can be of some help to someone else in the future.
One last update: J. Bruce Fields, one of the NFSv4 developers, has confirmed that this is a bug, and says it's limited to NFSv4. Apparently I was the first to report it. He's hoping to have a patch soon.
Remember, kids: When you find a bug, find the proper place to report it, and there's a good chance it'll get fixed. Hurray for open source. :-)
Best Answer
There is no default as such for ext4, it depends on the size of the device and the options chosen at creation. You can check the existing limits using
For example,
As per
man mkfs.ext4