Operating System - HP-UX
1836987 Members
2267 Online
110111 Solutions
New Discussion

Re: maximum number of files in a directory

 
Gregory Locke
Frequent Advisor

maximum number of files in a directory

Hi All:

Does anyone happen to know the maximum number of files that can be stored in a single directory. My system is a Itanium x6600 running HP-UX 11.23 w/ 16gb ram.

Thank you.
7 REPLIES 7
James R. Ferguson
Acclaimed Contributor

Re: maximum number of files in a directory

Hi Gregory:

There is no practical limit to the number of inodes that a VxFS filesystem can allocate as long as 'largefiles' is enabled for it.

The issue really is performance. The more files in a directory (and a filesystem's mountpoint is that too), the slower it will be to search the directory. This includes not only running utilities like 'find' but in simply attempting to execute something that lives in a directory with many, many other files.

Regards!

...JRF...
David Bellamy
Respected Contributor

Re: maximum number of files in a directory

Gregory that depends on a lot of things
1. what size is the directory
2. what size is the files.
A. Clay Stephenson
Acclaimed Contributor

Re: maximum number of files in a directory

There is essentially no limit as the limit is ultimately the size of the filesystem (or the number of inodes if the filesystem was created with a fixed number of inodes rather than the default method of dynamically expanding the number of inodes). Having said this, if you are asking this question then almost certainly you are considering a very bad design because you are going to see long search times in directories. While the file system can handle millions of files per directory that doesn't mean that this is a wise use of a file system. Generally, this approach is used as a very poor substitute for a database.
If it ain't broke, I can fix that.
Gregory Locke
Frequent Advisor

Re: maximum number of files in a directory

Hi All:

It is a 10gb partition. The files are output from a program. The bulk of the files are 0kb in size, just pointers. The others average about 4mg in size. A new directory is created for each month's output. The directory for this month so far is over 40000 files.
James R. Ferguson
Acclaimed Contributor

Re: maximum number of files in a directory

Hi (again) Gregory:

It's not the SIZE of the files, it's the NUMBER of them that matter. Searching a directory becomes slower as the number of elements therein becomes larger.

Regards!

...JRF...
Gregory Locke
Frequent Advisor

Re: maximum number of files in a directory

Thanks all!
Dennis Handly
Acclaimed Contributor

Re: maximum number of files in a directory

As mentioned by others, you may want a directory for each day's output. That would take it down to ~1000 per directory.
Just create a subdirectory for each day.