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.
-
it depends entirely on the filesystem you use. note: using many folders is not good from performance perspective...– Karoly HorvathFeb 8, 2012 at 13:10
-
232000 on ext3 64000 or even more on ext4– BantharFeb 8, 2012 at 13:15
-
ReiserFS wins with up to 1,200,000 files per dir limited by r5 hash as to 3.6 version.– maverikFeb 8, 2012 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 BadriFeb 8, 2012 at 13:32
-
1Try using a DBMS– GarrettFeb 8, 2012 at 16:26
2 Answers
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.
-
I have no problem with the disk size. my concern is if it is ok to store 30000+ subfolder in a folder– Mahmoud BadriFeb 8, 2012 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.– hakreFeb 8, 2012 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.