Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 Feb 2001 19:55:08 -0600 (CST)
From:      Mike Meyer <mwm@mired.org>
To:        Tim McMillen <timcm@umich.edu>, hiuho@yahoo.com
Cc:        questions@freebsd.org
Subject:   Re: Limit on number of sub-directories?
Message-ID:  <14977.64636.712018.404928@guru.mired.org>
In-Reply-To: <60468191@toto.iv>

next in thread | previous in thread | raw e-mail | index | archive | help
Tim McMillen <timcm@umich.edu> types:
> > Is there a limit on the number of sub-directories I can have in a
> > directory?  (I'm using FreeBSD 4.0, 4.1, and 4.2.)  Thank you.
> 
> Yes, but it is pretty large.  I'm not an ffs expert, but after reading 
> in the SMM, the only limit I see is in the number of inodes allocated 
> when the filesystem is created.  See man newfs for the info on how many 
> inodes are created.  As I understand it, by default there is an inode 
> created for every 4k of disk space per filesystem.  So it is possible 
> to create too many directories and use up all the inodes.  That means 
> you could only create 250 files in a MB of space.  But for a 1gb 
> filesystem that works out to 250,000 fiels so it should be enough.  As 
> it says in the manpage that means the average file is expected to be 
> 4k.  If yours is smaller you need more inodes.

The number of inodes in the file system is probably the lowest one,
and the only one you're likely to run in practice. Since a directory
entry uses up disk space other than in the i-list, you could run out
of real disk space as well. You can also hit the file systems file
size limit for the directory proper. Finally, each subdirectory adds a
link to the directory, which increases the link count, which is an int
(oddly enough, it's not unsigned).

	<mike
--
Mike Meyer <mwm@mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




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