From: Casper H.S. Dik on
Ceri Davies <ceri_usenet(a)submonkey.net> writes:

>On 2010-05-18, underh20 <underh20.scubadiving(a)gmail.com> wrote:
>> Hello,
>>
>> What is the maximum number of files allowed in a directory under UFS
>> in Solaris 10 ?

>32767. See MAXLINK in sys/param.h.

Not correct; that is the limit on the number of sub directories inside
a single directory. You can created millions of files inside a directory
but the performance (esp for UFS) will be poor.

Casper
--
Expressed in this posting are my opinions. They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.
From: Casper H.S. Dik on
Ceri Davies <ceri_usenet(a)submonkey.net> writes:

>On 2010-05-19, Stefan Krueger <stadtkind2(a)gmx.de> wrote:
>> On 2010-05-19, Ceri Davies <ceri_usenet(a)submonkey.net> wrote:
>>> On 2010-05-18, underh20 <underh20.scubadiving(a)gmail.com> wrote:
>>>> Hello,
>>>>
>>>> What is the maximum number of files allowed in a directory under UFS
>>>> in Solaris 10 ?
>>>
>>> 32767. See MAXLINK in sys/param.h.
>>
>> some people here wrote they've seen 70k+ files in single directory...

>Not on UFS.

>> anyway, MAXLINK seems to be the maximum number of (hard?)links to a
>> file and also the limit of subdirectories, see Solaris Internals,
>> Second Edition, Page 740-741 "ic_nlink"
>>
>> I'm still trying to figure out the max. number of files in a
>> directory though... maybe someone else can shed some light on this :)

>Or I could, as I'd already looked before replying:

>From usr/src/uts/common/fs/ufs/ufs_dir.c:

> 804 * Write a new directory entry for DE_LINK, DE_SYMLINK or DE_RENAME operations.
> 805 * If tvpp is non-null, return with the pointer to the target vnode.
> 806 */
> 807 int
> 808 ufs_direnter_lr(
>...
> 877 if (sip->i_nlink == MAXLINK) {
> 878 rw_exit(&sip->i_contents);
> 879 return (EMLINK);
> 880 }

>MAXLINK is defined (and included from) sys/param.h as:

>#define MAXLINK 32767 /* max links */


That's only for directories, not for files.

Casper
--
Expressed in this posting are my opinions. They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.
From: Andrew Gabriel on
In article <4bf4f6b0$0$22938$e4fe514c(a)news.xs4all.nl>,
Casper H.S. Dik <Casper.Dik(a)Sun.COM> writes:
> Ceri Davies <ceri_usenet(a)submonkey.net> writes:
>
>>On 2010-05-18, underh20 <underh20.scubadiving(a)gmail.com> wrote:
>>> Hello,
>>>
>>> What is the maximum number of files allowed in a directory under UFS
>>> in Solaris 10 ?
>
>>32767. See MAXLINK in sys/param.h.
>
> Not correct; that is the limit on the number of sub directories inside
> a single directory. You can created millions of files inside a directory
> but the performance (esp for UFS) will be poor.

Even if the filesystem and application does it efficiently, waiting
for ls(1) to sort a million files into alphabetic order still makes
it an admin's nightmare when they have to dive in to see what's gone
wrong, and things like rm {some shell expression} will blow up with
too many arguments. You just don't want to go there...

--
Andrew Gabriel
[email address is not usable -- followup in the newsgroup]