[SLL] limit on number of files in a directory and hashed dir vs. flat dir file access time

Chuck Wolber chuckw at quantumlinux.com
Wed Oct 31 17:43:22 PDT 2007


On Wed, 31 Oct 2007, Xeno Campanoli wrote:

> Adam Monsen wrote:
> > Is there a limit on the number of files in a directory other than just the
> > inode limit of a particular partition? I'm using the ext3 filesystem. Ubuntu
> > 7.10.
> 
> Yes.  See:
> 
> something_fs.h where something is your filesystem time (like ext3, which 
> is most typical right now) in /usr/include/linux and there will be a 
> macro definition like:
> 
> #define EXT2_LINK_MAX 32000

That doesn't seem right to me and in fact I just verified that my system 
at home (running kernel 2.6.15) has that macro at the same value and I'm 
easily able to fit more than 32000 files into a directory:

for i in `seq 1 33000`
do
	touch $i
done

Works great. In fact I can even list them all with ls pretty quickly. I've 
augmented the test to add 1,000,000 files into the directory, but that's 
going to take a while. I'm up to 40,000 as I type this...


> implying that the maximum number of links to anything is 32000, which 
> limits a directory to 32000 files.  Now you can make that infinite by 
> having subdirectories, and you can also compile your own kernel to have 
> more links.  However typically production shops like standard kernels 
> (some in fact insist on "supported" kernels from chimera corporations 
> like RedHat) so you may find kernelmaking is not allowed for your work, 
> however, it probably wouldn't be hard to try.  Of course once you change 
> one limit, you don't always know, especially as a novice, what other 
> limits you'll run into next and when, so don't take the step lightly.

I'm doing my test with a stock Debian kernel. I haven't made any changes 
to it.

FWIW: I can vouch for the fact that Adam's the furthest thing from a 
novice.


..Chuck..


-- 
http://www.quantumlinux.com
 Quantum Linux Laboratories, LLC.
 ACCELERATING Business with Open Technology

"Stay Hungry. Stay Foolish."
	-The Whole Earth Catalog


More information about the linux-list mailing list