Operating System - HP-UX
1833229 Members
2689 Online
110051 Solutions
New Discussion

Re: Maximum number of files under a directory

 
SOLVED
Go to solution
j773303
Super Advisor

Maximum number of files under a directory

Does anyone knows Maximum number of files under a directory? Any document mentioned about this . Thanks.

OS 11.11 and 11.23
Hero
3 REPLIES 3
Bill Hassell
Honored Contributor
Solution

Re: Maximum number of files under a directory

For VxFS filesystems, there is no limit as long as there is disk space. The VxFS filesystem adds inodes as needed, so millions of files can be created.

That said, it is an unbelievably BAD idea to create even thousands of files in a single directory. The usual directory query tools such as ls and ll will be almost useless: a million files will take several minutes to list with ls, and pattern matching using * will almost ALWAYS report LINE TOO LONG. And using grep to find something in some of those millions of files will take 10's of minutes depending on the size of each file.

Whenever I see this type of a request, it is almost always a request to get around using a real database. Save yourself a lot of wasted effort and use a real database.


Bill Hassell, sysadmin
A. Clay Stephenson
Acclaimed Contributor

Re: Maximum number of files under a directory

There is one more limit imposed upon vxfs filesystems unless largefiles are enabled. The underlying data structures within the filesystem cannot exceed 2GiB unless largefiles are enabled and that can limit the number of files before the actual filesystem space is actually exhausted. In any event, it's a state of the art stupid design that comtemplates the need for your question. While the filesystem can support millions of files in a directory, it's never a good idea.
If it ain't broke, I can fix that.
j773303
Super Advisor

Re: Maximum number of files under a directory

Thanks, I got it.
Hero