From: Ceri Davies on
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.

> What is the maximum number of files allowed in a directory under
> Veritas File System 5.0 in Solaris 10 ?

32767.

> I'd like to know where to locate this maximum number under UFS and
> Veritas File System 5.0 in Solaris 10. Is there any way that we could
> modify this maximum number ?

For vxfs, add "set vxfs:vx_maxlink=65534" to /etc/system and reboot.
For UFS, I don't know that you can.

Ceri
--
That must be wonderful! I don't understand it at all.
-- Moliere
From: Stefan Krueger on
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...

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 :)
From: Ceri Davies on
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 */

Ceri
--
That must be wonderful! I don't understand it at all.
-- Moliere
From: Stefan Krueger on
On 2010-05-19, Ceri Davies <ceri_usenet(a)submonkey.net> wrote:
> 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 */

"Write a new directory entry", directory != file and this basically
proofs what I wrote, so thanks for that :-)

anyway, to stop guessing I wrote a small shell script which just
touch'es files (on Solaris 10, UFS), I made it stop at 50.000, I hope
that's ok

$ ls | wc -l
50001

So... I think the max. num of files in a directory is only limited by
the number of free inodes

HTH