jaime
04-26-2001, 05:03 PM
Hello,
I heard somewhere that Linux has a limitation in the number of directories at the same location ( maximum of 1000 or something like that)...
Does anyone know if this is correct?
The maximum amount of directories depends on which filesystem you use. Normally, you would use something like the ext2 filesystem for Linux. Here the amount of directories is especially limited by the amount of inodes on the drive. The amount of inodes can be set during formatting.
You can try running this command, that will list the amount of inodes on your drive:
df -i
Normally, you would have a least a 10^6 inodes... (i.e. you will not run into a directory limitation anytime soon).
jaime
04-27-2001, 11:02 AM
Thanks for your reply.
I executed that command and I got:
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/hda1 192512 33018 159494 17% /
/dev/hda3 51376 567 50809 1% /var
/dev/hda4 2166784 29436 2137348 1% /home
In the volume "home" it displays that I have 29436 Inodes used.
Do I really have 29.436 existing directories?
Do I still have 2137348 free dirs?
No, no...
Inodes are not just used for directories. They are used for files as well... (actually - in Linux a directory is a file).
jaime
04-27-2001, 12:34 PM
Thanks for your clear explanation...
All is about that I want to install a redirection service for the users in my server (over 3000 members) and I need a directory for each one.
Thanks again. ;)
Alter
04-28-2001, 07:22 PM
The problem connected with number of directories really exists. The number of directories that Linux can endure depends upon kernel version. The number may vary from 20,000 to 80,000 and more.
:idea: I'd recommend you to use the power and flexibility of mod_rewrite (http://httpd.apache.org/docs/misc/rewriteguide.html) Apache module instead of creating actual directory for each user.
Originally posted by Alter
The problem connected with number of directories really exists. The number of directories that Linux can endure depends upon kernel version. The number may vary from 20,000 to 80,000 and more.
Where do you find this limitation?
With 2.2 kernels I do not see that limitation anywhere. If you're worried about performance, then reiserfs nicely handles a lot of small files or a lot of small directories.
--
Jens Kristian Søgaard, Mermaid Consulting I/S,
jens@mermaidconsulting.dk,
http://www.mermaidconsulting.com/
Alter
04-29-2001, 05:01 AM
Originally posted by jks
Where do you find this limitation?
With 2.2 kernels I do not see that limitation anywhere. If you're worried about performance, then reiserfs nicely handles a lot of small files or a lot of small directories.
It is a known problem... It is possible to bring down practically anyone Linux, by creating the nested directories. As the result can be corrupting of a file system. For us the system fell on 20 thousand directories.
Originally posted by Alter
It is a known problem... It is possible to bring down practically anyone Linux, by creating the nested directories. As the result can be corrupting of a file system. For us the system fell on 20 thousand directories.
Well, we were not talking about nested directories at all. He just wanted a large amount of directories - one for each user.
I just tried creating twenty thousand directories on my small Linux workstation -- no problem at all (well, it took 2 minutes to create them...). Now I'm trying to create 100 thousand directories... (it's probably going to take 10 minutes to complete).
All being said -- if he just wants a web page or redirector for each user - he would be better of serving the hits from a combination of for example PHP and MySQL (i.e. having one PHP page that receives all the hits, by means of mod_rewrite or similar).
--
Jens Kristian Søgaard, Mermaid Consulting I/S,
jens@mermaidconsulting.dk,
http://www.mermaidconsulting.com/
cimshimy
04-29-2001, 10:35 PM
There is a patch available somewhere for the nested directory bug that will make it error instead of creating the directories until the filesystems falls over.
Other than that, the unpatched Linux kernel itself doesn't have a limit on the amount of directories.. more like a limit on the length of the path.
Andrew