The typical file limit of a folder on *nix file systems

filesystems

Obviously, if you stick a lot of files in one folder, the efficiency of various file operations is going to go down (e.g. ls takes a lot longer). However, what's the limit for how many files you can stick in a folder before it chokes on you? Obviously, this may vary from file system to file system, but I would think that they'd at least be similar in their limits. Can you stuff files in there until you run out of disk space, or are going to run into some sort of limit like you can only put 65536 (or some other multiple of 2) files in a folder before your file system chokes on you?

I'm most interested in jfs, since that's what I use primarily use for my large partitions, but it would be good to know for *nix file systems in general.

Best Answer

In the old UFS, directory size was limited only by your disk space as directories are just files which - like other files - have effectively unbounded length. I don't know, but expect that JFS is no different.

As to how much is too much, it reminds me of the story of the manager who notices that when there are more than 8 users on the machine, performance drops dramatically so he asks the system administrator to find the 8 in the code and change it to 16. The point being that there is no 8, it is an emergent property of the system as a whole. How to know how big is too big? The only practical way is to add entries until it takes longer than you want. This is obviously a rather subjective approach but there isn't any other.

If you are looking to store 65k+ files, there are probably better approaches depending on the nature of your data and how you wish to access it.

Related Question