[Samba] Too Many Files Open

Eric Boehm boehm at nortelnetworks.com
Wed Aug 14 13:39:01 GMT 2002

On Tue, Aug 13, 2002 at 04:07:39PM +0200, J. Simons wrote:
>>>>> "Joel" == J Simons <j.simons at thissen-gmbh.de> writes:

    Joel> Our CAD Drawings are stored on a Samba Share. We want to
    Joel> open large Assembly's but we get following errors:

    [2002/08/06 12:47:59, 0] lib/debug.c:reopen_logs(348) Unable to open new 
    log file /usr/local/samba/var/log.smbd: Too many open files
    [2002/08/06 12:48:49, 0] lib/debug.c:reopen_logs(348) Unable to open new 
    log file /usr/local/samba/var/log.smbd: Too many open files
    [2002/08/06 12:48:49, 0] smbd/service.c:make_connection(349) Couldn't find 
    account joel

By default, Samba will try to set 'max open files = 10000'. Assuming
that you didn't override this, you may still need to increase the
number of file-handles available to a process.

The relevant sysctl variables are

sysctl fs.file-max fs.file-nr
fs.file-max = 8192
fs.file-nr = 768        215     8192

The value in file-max denotes the maximum number of file-
handles that the Linux kernel will allocate. When you get lots
of error messages about running out of file handles, you might
want to increase this limit.

The three values in file-nr denote the number of allocated file
handles, the number of free file handles and the maximum number of
file handles. The number of free file handles is counted out of the
number of allocated file handles. This means, that the number of used
file handles is (allocated-free) and at any given time, one can open
up to (maximum-(allocated-free)) additional file handles. If this
number gets close to zero, you probably want to increase the maximum,
by writing to file-max, or you'll start getting errors when programs
try to open files

You might want to increase fs.file-max to 16384 or higher if you've
set 'max open files' in your smb.conf.

You can use several methods to set/change the value

1. echo 16384 > /proc/sys/fs/file-max
2. sysctl fs.file-max=16384
3. edit /etc/sysctl.conf and insert the line

The first two methods will only last until the next reboot. The last
method will work across reboots.

Eric M. Boehm                  /"\  ASCII Ribbon Campaign
boehm at nortelnetworks.com       \ /  No HTML or RTF in mail
                                X   No proprietary word-processing
Respect Open Standards         / \  files in mail

More information about the samba mailing list