maximum number of subdirectories?

maximum number of subdirectories?

Post by Jay Schwante » Sun, 13 May 2001 02:35:23



Is there a maximum number of subdirectories under one directory in a
linux environment?
I have a need to create about 1000 subdirectories under one directory -
will I create any problems doing so?
 
 
 

maximum number of subdirectories?

Post by Barry Margoli » Sun, 13 May 2001 03:09:35




Quote:>Is there a maximum number of subdirectories under one directory in a
>linux environment?
>I have a need to create about 1000 subdirectories under one directory -
>will I create any problems doing so?

No, there's no limit specific to subdirectories.  The only limit is the
total number of inodes in the filesystem, which applies to files and
directories all combined.

--

Genuity, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

 
 
 

maximum number of subdirectories?

Post by Nate Eldredg » Sun, 13 May 2001 10:53:32



> Is there a maximum number of subdirectories under one directory in a
> linux environment?
> I have a need to create about 1000 subdirectories under one directory -
> will I create any problems doing so?

Probably not.

AFAIK, the only actual limit on number of subdirectories occurs when
you overflow the link count, which is 16 bits.  So less than 65536
subdirectories and you should be fine.

Note that there is a possible performance problem here, though.  Many
filesystems, including ext2, have to do a linear search through a
directory to find an entry in it.  So if you have many items in a
directory, access in it will be slower.  More advanced filesystems
like reiserfs use hashing to eliminate this problem.

--

Nate Eldredge

 
 
 

maximum number of subdirectories?

Post by Geoff Clar » Thu, 17 May 2001 21:57:46



>>Is there a maximum number of subdirectories under one directory in a
>>linux environment?
>No, there's no limit specific to subdirectories.  The only limit is the
>total number of inodes in the filesystem, which applies to files and
>directories all combined.

Most systems (Linux included) implement the ".." entry of each subdirectory
as a hard-link to the parent directory, so the number of subdirectories is
limited to the hard-link limit (minus 2).  The hard-link limit can be
determined using "getconf LINK_MAX directory_name".  This can be as low
as 1000 on some systems, although on the Linux box I am typing this on it
is 32000 for directories on ext2 filesystems.

--