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

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Nov 09, 2008 at 10:35:21AM +0100, Erik Trulsson wrote:
> 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.

I hadn't even thought of that (the inode possibility did cross my mind,
but I figured inode counts would a) apply to the filesystem as a whole,
and b) apply to both files and directories.

Wow, thanks for the tip!  Learning something new every day...  :-)

> 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.

-- 
| Jeremy Chadwick                                jdc at parodius.com |
| Parodius Networking                       http://www.parodius.com/ |
| UNIX Systems Administrator                  Mountain View, CA, USA |
| Making life hard for others since 1977.              PGP: 4BD6C0CB |




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