Question about filesystem and limits

Erik Trulsson ertr1013 at
Thu Feb 3 09:57:09 PST 2005

On Thu, Feb 03, 2005 at 07:07:27PM +0100, Robert Goossens wrote:
> Dear FreeBSD,
> I am using FreeBSD (5) on my LAN as a gatweay/router and for website developement.
> I have some questions I cannot find answers for.
> Please can you tell me what are the limits of...
> 1. the number of files that a directory can store.

As many as can fit on the disk, i.e. no specific limit.

> 2. the number of directories that a directory can have.


(Each inode can have at most 32767 hardlinks to it (signed 16-bit
integer), and each subdirectory contains a hardlink to its parent (teh
".." entry). Subtract the two hardlinks that each directory has (the
"." entry, and the entry in the parent directory) and you end up with

> 3. the length of a path to a file name

The open(2) and chdir(2) manpages says that one error that can occur is:

   [ENAMETOOLONG]     A component of a pathname exceeded 255 characters, or
                      an entire path name exceeded 1023 characters.

To work around this one can of course use chdir(2) to descend down the
directory tree one level at a time; there is no limit to how deep down
the directory tree a file may reside, just on how long pathnames one
can pass to syscalls/library functions.

<Insert your favourite quote here.>
Erik Trulsson
ertr1013 at

More information about the freebsd-questions mailing list