Max # of files/dirs under Linux?

bscott at ntisys.com bscott at ntisys.com
Tue Dec 10 11:05:03 EST 2002


On Tue, 10 Dec 2002, at 10:21am, pll at lanminds.com wrote:
> What's the max number of files and/or directories possible in a single
> file system under Linux?

  That, I believe, should be effectively unlimited.  Files and directories
are just links.  (Of course, there's the 'dentry' thing, which I don't
understand.  That may complicate things.  Or it may have nothing to do with
it.  Anyone?)

  There would be a limit on the number of visible inodes in any filesystem,
at the VFS level.  It wouldn't surprise me if it was stored in a 32-bit
unsigned int on x86 platforms (roughly 4.3 billion).

> Is that a tweakable function of the kernel, or the particular fs being
> used?

  Well, both.  The kernel VFS layer is going to have limits, and the
filesystem implementation is going to have limits.  The effective limits
will be the intersection of the two.  For example, MS-FAT has a number of
stupid limits that Linux can easily exceed.  At the same time, ext2/3 has
certain limits which exceed limitations of the Linux kernel on 32-bit
platforms.

> If the latter, then how drastically does it differ between ext2/3, XFS,
> ReiserFS?

  I dunno about Reiser or XFS.

  EXT2/3 is a pretty traditional Unix filesystem.  The maximum number of
files or directories in the filesystem will be the number of inodes in the
filesystem.

  Of course, these are all theoretical limits.  Hardware and performance
considerations can make a big difference.  For example, a common problem
with EXT2/3 is that, because it stores directories in a flat, unordered
list, the cost of finding a file in a directory is a quadratic function of
the number of entires in the directory.  (There are patches that aim to
solve this problem in EXT3.)

-- 
Ben Scott <bscott at ntisys.com>
| The opinions expressed in this message are those of the author and do not |
| necessarily represent the views or policy of any other person, entity or  |
| organization.  All information is provided without warranty of any kind.  |




More information about the gnhlug-discuss mailing list