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, [EMAIL PROTECTED] 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 |

_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to