1835910 Members
3076 Online
110086 Solutions
New Discussion

Maximum number of files?

 
Yvonne Butler
Regular Advisor

Maximum number of files?

I can't remember seeing it documented anywhere but does anyone know if there's a maximum number of files limit per directory, or is there a kernel parameter that sets this?

Thanks
8 REPLIES 8
Stefan Farrelly
Honored Contributor

Re: Maximum number of files?

no, there is no maximum per directory or kernel parameter for this.

There have been discussions as to whats the theoretical maximium files per dir before performance drops off significantly - and I think it was around 100-150,000 files per dir.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Hai Nguyen_1
Honored Contributor

Re: Maximum number of files?

Yvonne,

Vxfs filesystems will dynamically adjust the number of files, dirs for Vxfs filesystems. As for hfs filesystem (it is /stand in this case), the number of inodes is fixed. Therefore, the number of files, dirs is fixed too.

Hai
James R. Ferguson
Acclaimed Contributor

Re: Maximum number of files?

Hi:

VxFS filesystems have unlimited inode capability constrained only by available disk space.

There is a kernel tunable called 'vx_maxlink' which has a ceiling of 2147483647. This is the maxiumum number of subdirectories in a VxFS filesystem.

Regards!

...JRF...
Systeemingenieurs Infoc
Valued Contributor

Re: Maximum number of files?

there is a maximum number of direct subdirectories of a directory (see man 2 mkdir [EMLINK]), and the max is 32767 (grep LINK_MAX /usr/include/limits.h) ; in a vxfs there is no limit on the number of files. If you put the files in a hierachical directory tree, there isn't even a max. theorectical limit. We have fs's containing +20M files.
A Life ? Cool ! Where can I download one of those from ?
Yvonne Butler
Regular Advisor

Re: Maximum number of files?

Thanks everyone - this has been very helpful...
Gary Yu
Super Advisor

Re: Maximum number of files?

Hi All,

I have another question about max file numbers -- sometime when you using '*' to run tar or even ls against a directory with lots files, it will fail, is there any such limitations?

thanks,
A. Clay Stephenson
Acclaimed Contributor

Re: Maximum number of files?

I will say that whenever someone asks a question like maximum number of files per directory that I tend to shudder because in almost all cases it points to a bad software design. Unix filesystems are treelike for a reason. First, directory searches are linear and any additions to a directory (e.g. adding a new file) require that the directory be re-written. If at all possible, choose a better strategy.

As for Gary's question, that really has nothing to do with the size of the directory but rather with the maximum arguments size that the shell will handle.
If it ain't broke, I can fix that.
Michael Lampi
Trusted Contributor

Re: Maximum number of files?

HP-UX has troubles with *really* *big* directories, especially under HFS. I have seen a C3600 under HP-UX 11i grind to a crawl with directories containing 100,000 files. Utilities accessing the directories frequently crash, or take forever to complete.

Most shell programs also have troubles when referencing such large directories, too.

There have been some patches released (about a year ago)that fix some of the really outrageous problems, but I would not recommend building huge flat directories.
A journey of 1000 steps ends in a mile.