Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there a logical limit as to how many folders I can store inside a single folder in a hosting server (linux)? I`m talking about tens of thousands of folders.

share|improve this question

migrated from stackoverflow.com Feb 8 '12 at 14:57

This question came from our site for professional and enthusiast programmers.

    
it depends entirely on the filesystem you use. note: using many folders is not good from performance perspective... –  Karoly Horvath Feb 8 '12 at 13:10
2  
32000 on ext3 64000 or even more on ext4 –  Banthar Feb 8 '12 at 13:15
    
ReiserFS wins with up to 1,200,000 files per dir limited by r5 hash as to 3.6 version. –  maverik Feb 8 '12 at 13:21
    
then how to deal with the situation that you have tens of thousands of repeating data that are all of the same category? how to store them on the server in a good way? –  Mahmoud Badri Feb 8 '12 at 13:32
1  
Try using a DBMS –  Garrett Feb 8 '12 at 16:26

2 Answers 2

Is there a logical limit as to how many folders I can store inside a single folder in a hosting server (linux)?

Yes, there is a limit. You have a limit with everything inside the computer, because each computer is of limited resources. Especially with hard-drives, they have a limited amount of space. As each directory consumes space for it's name at least, this will be always limited by the space of the drive.

Next to that, the file-system itself has limits in the way how it organizes the data. This depends on the type and version of file-system you're using then.

share|improve this answer
    
I have no problem with the disk size. my concern is if it is ok to store 30000+ subfolder in a folder –  Mahmoud Badri Feb 8 '12 at 14:20
    
Your concern is right, 30000+ might be over the maximum logical limit the device and it's software abstraction layer is able to offer you. You should first of all tell what is the absolute maximum number of folders you want to support (not a + at the end, but the real maximum, real in the sense of sepcification, that and no more must be supported). Then you should address which file-system you're using. –  hakre Feb 8 '12 at 14:23

Every file and directory in POSIX file systems are represented by an Inode. A number of Inodes are assigned at the time of the creation of the filesystem as a fraction of the total filesystem size. This is normally done automatically but it can also be specified manually (mkfs.ext4 -N). To see how many Inodes you have available use the df -i command:

nimblex:~# df -i
Filesystem       Inodes   IUsed    IFree IUse% Mounted on
rootfs          2048273   28976  2019297    2% /

In this case, where I have a 16G filesystem, you can see that I can create over 2 million files and directories. On another 300GB filesystem ext4 formatted I have ~20 million Inodes available.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.