Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Sep 2004 00:58:14 +0200
From:      Erik Trulsson <ertr1013@student.uu.se>
To:        Danny MacMillan <flowers@users.sourceforge.net>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Max # of Files in a Directory?
Message-ID:  <20040902225813.GA29223@falcon.midgard.homeip.net>
In-Reply-To: <20040902224043.GA30143@procyon.nekulturny.org>
References:  <20040902224043.GA30143@procyon.nekulturny.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Sep 02, 2004 at 04:40:43PM -0600, Danny MacMillan wrote:
> Hi.
> 
> I googled for this but I couldn't find an answer.
> 
> What is the largest number of files that can exist
> in a single directory in FreeBSD?  I ask because
> I'm using courier-imap using a Maildir mailbox
> and I started seeing all kinds of errors when
> trying to copy more than 16383 messages into one
> of my folders there.  I'm retrieving mail from a
> pop3 server using Outlook then copying them into
> my imap folder, also using Outlook.
> 
> I guess my real question is, what is the bottleneck
> in this situation?  Outlook?  courier-imap?  Or
> FreeBSD?

I don't think there is any limit to how many files you can have in a
single directory - or, if there is some limit, the limit is very large:
on the order of hundreds of thousands of files or more (at which point
directory operations would extremly slow anyway so nobody in his right
mind would have so many files in a single directory.)

There is a limit to how many subdirectories you can have in a single
directory - that limit is 32765.  This is tied to the how many
hardlinks you can have to a single directory entry (32767: the value is
stored in the inode as a signed 16-bit value) and every subdirectory
contains a hardlink to its parent (the ".." entry.)


Anyway, if you run into trouble when trying to copy more than 16383
messages, then it is not FreeBSD which is to blame.
Personally I would bet on Outlook being the culprit, but then I am a
bit prejudiced against all Microsoft products.


-- 
<Insert your favourite quote here.>
Erik Trulsson
ertr1013@student.uu.se



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040902225813.GA29223>