Xref: utzoo comp.unix.wizards:15489 comp.unix.questions:12776 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!tank!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.unix.wizards,comp.unix.questions Subject: Re: unix question: files per directory Keywords: how many can there be? Message-ID: <16839@mimsy.UUCP> Date: 11 Apr 89 04:49:27 GMT References: <24110@beta.lanl.gov> Distribution: na Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 22 In article <24110@beta.lanl.gov> dxxb@beta.lanl.gov (David W. Barts) writes: >How many files can there be in a single UNIX directory .... >I realize that as directories get bigger, they slow down, but >how much? Just what IS the maximum directory size? The maximum size is the same as for files, namely 2^31 - 1 (2147483647) bytes. (This is due to the use of a signed 32 bit integer for off_t. The limit is larger in some Unixes [Cray], but is usually smaller due to disk space limits.) Directory performance falls off somewhat at single indirect blocks, moreso at double indirects, and still more at triple indirects. It takes about 96 kbytes to go to single indirects in a 4BSD 8K/1K file system. Each directory entry requires a minimum of 12 bytes (4BSD) or exactly 16 bytes (SysV); 16 is a nice `typical' size, so divide 96*1024 by 16 to get 6144 entries before indirecting on a BSD 8K/1K file system. The actual slowdown due to indirect blocks is not clear; you will have to measure that yourself. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris