From owner-freebsd-questions@FreeBSD.ORG Sun Nov 9 09:38:46 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 617E01065673 for ; Sun, 9 Nov 2008 09:38:46 +0000 (UTC) (envelope-from jdc@koitsu.dyndns.org) Received: from QMTA08.westchester.pa.mail.comcast.net (qmta08.westchester.pa.mail.comcast.net [76.96.62.80]) by mx1.freebsd.org (Postfix) with ESMTP id 0B1938FC0C for ; Sun, 9 Nov 2008 09:38:45 +0000 (UTC) (envelope-from jdc@koitsu.dyndns.org) Received: from OMTA01.westchester.pa.mail.comcast.net ([76.96.62.11]) by QMTA08.westchester.pa.mail.comcast.net with comcast id cxdj1a0020EZKEL58xeECV; Sun, 09 Nov 2008 09:38:14 +0000 Received: from koitsu.dyndns.org ([69.181.141.110]) by OMTA01.westchester.pa.mail.comcast.net with comcast id cxek1a0042P6wsM3Mxekqs; Sun, 09 Nov 2008 09:38:45 +0000 X-Authority-Analysis: v=1.0 c=1 a=QycZ5dHgAAAA:8 a=YcPDmIw7YTAXLyw63hgA:9 a=MRO93RFXp79kc9omaLf_J6nn0ScA:4 a=EoioJ0NPDVgA:10 a=LY0hPdMaydYA:10 Received: by icarus.home.lan (Postfix, from userid 1000) id C50BD5C19; Sun, 9 Nov 2008 01:38:43 -0800 (PST) Date: Sun, 9 Nov 2008 01:38:43 -0800 From: Jeremy Chadwick To: Erik Trulsson Message-ID: <20081109093843.GA35192@icarus.home.lan> References: <50261.1226194851@people.net.au> <20081109024046.GB27423@icarus.home.lan> <20081109093521.GA73108@owl.midgard.homeip.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20081109093521.GA73108@owl.midgard.homeip.net> User-Agent: Mutt/1.5.18 (2008-05-17) Cc: freebsd-questions@freebsd.org, no-spam@people.net.au Subject: Re: UFS2 limits X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Nov 2008 09:38:46 -0000 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 |