Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Nov 2008 10:35:21 +0100
From:      Erik Trulsson <ertr1013@student.uu.se>
To:        Jeremy Chadwick <koitsu@FreeBSD.org>
Cc:        freebsd-questions@freebsd.org, no-spam@people.net.au
Subject:   Re: UFS2 limits
Message-ID:  <20081109093521.GA73108@owl.midgard.homeip.net>
In-Reply-To: <20081109024046.GB27423@icarus.home.lan>
References:  <50261.1226194851@people.net.au> <20081109024046.GB27423@icarus.home.lan>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Nov 08, 2008 at 06:40:46PM -0800, Jeremy Chadwick wrote:
> On Sun, Nov 09, 2008 at 01:40:51AM +0000, no-spam@people.net.au wrote:
> > Hi,
> > I have a FreeBSD server that has about 10,500 subdirectories within a single
> > directory.
> > This number will keep rising and I assume UFS2 has a limit to the number of
> > sub-directories in a single directory - can anyone tell me what it is?
> 
> As far as I know, there is no such limit on the number of files/dirs
> inside of a directory.

Actually there is.  Each i-node on the disk contains a field telling how
many hard-links point to that inode. This field is a (signed) 16-bit value,
meaning the maximum number of hardlinks allowed is 32767.
Each subdirectory created contains a hardlink ('..') to its parent, thus
limiting the number of subdirectories to a single directory to less than 32767.

Note that this does not limit the number of files you can have in a single
directory, since normal files do not contain hardlinks to the parent
directory, but there are of course limits to the total number of files and
directories you can have on a single filesystem based on how many inodes
were created when the filesystem was first created.




-- 
<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?20081109093521.GA73108>