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

Adam Monsen haircut at gmail.com
Wed Oct 31 17:50:15 PDT 2007


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.

Follow up question: is it more efficient (as far as reads are concerned) to
"hash" files into subdirectories rather than just throw them all in a single
directory? For instance, say I have 1 million 100 kilobyte JPEG images named
as follows:
000000.jpg
000001.jpg
000002.jpg
...
999999.jpg

Would it speed up read time for a particular image if images were placed in
directories like:

0/0/0/0/0/1/000001.jpg and
0/2/3/6/1/2/023612.jpg

and so on?


Here are some links I came across in my search, but if the answer I'm
looking for is in there, I must've just skimmed right past it:
http://en.wikipedia.org/wiki/Ext3
http://local.google.com/answers/threadview?id=403516
http://www.linuxquestions.org/questions/general-10/maximum-number-of-files-in-a-directory-183643/
http://ubuntuforums.org/archive/index.php/t-487196.html
http://www.nabble.com/Poor-Performance-WhenNumber-of-Files-%3E-1M-t4203660.html

-- 
Adam Monsen


More information about the linux-list mailing list