unix question: files per directory

Brandon S. Allbery allbery at ncoast.ORG
Tue Apr 18 12:00:27 AEST 1989


As quoted from <13577 at ncoast.ORG> by allbery at ncoast.ORG (Brandon S. Allbery):
+---------------
| System V has no limit, aside from maximum file size (as modified by ulimit,
| presumably).  As a PRACTICAL limit, when your directory goes triple-indirect,
>--------------------------------------------------------------^^^^^^  HAH!
| it is too slow to search in a reasonable amount of time.  Assuming the
| standard 2K block size of SVR3, this is (uhh, let's see... 2048 bytes/block
| / 16 bytes/dirent = 128 dirent/block; times 10 is 1280 dirent direct, add
| single-indirect = 128 * 512 pointers/block [2048 / 4 bytes/pointer] = 65,536
| entries single-direct; multiply that by 512 to get double-indirect)
| 33,621,248 directory entries before you go triple-indirect.
+---------------

I completely forgot about the inode limit.  System V limits you to 65,535
inodes per file system; as a result, your directory will never go
double-indirect.  However, even single-indirect is noticeably slower than
direct blocks.

++Brandon
-- 
Brandon S. Allbery, moderator of comp.sources.misc	     allbery at ncoast.org
uunet!hal.cwru.edu!ncoast!allbery		    ncoast!allbery at hal.cwru.edu
      Send comp.sources.misc submissions to comp-sources-misc@<backbone>
NCoast Public Access UN*X - (216) 781-6201, 300/1200/2400 baud, login: makeuser



More information about the Comp.unix.wizards mailing list