Smb4.conf additional configuration for max open files

Right after upgrading to SCALE I hit a max open files limit in Unreal Editor, causing crashes, and sometimes assets weren’t loading.
I had to enter the TrueNAS cli and set the following:

[TrueNAS SCALE]> service smb update smb_options="max open files = 1048576"

FYI the TrueNAS cli is a command line client to the sqlite database, open it by running cli in the shell.

The other thing I changed was that I created an override to the SMBD Systemd service file
systemctl edit smbd.service

[Service]
LimitNOFILE=1048576
LimitNOFILESoft=1048576

smbd now shows more than 16k max open files, and Unreal no longer crashes

cat /proc/$(pgrep -n smbd)/limits | grep 'open files'
Max open files            1048576              1048576              files

Seems like SCALE is using the SMBD defaults of 1024 files per CPU core.

EDIT: Maybe not. Maybe 16K files was picked since it’s the default for Windows 7, per @MikeHawkinsEidurmam in another post.

But then why is Core’s so much higher?

With TrueNAS Core 13.3-U1, this is the default on my system:
max open files = 938988

1 Like

https://www.samba.org/samba/docs/current/man-html/smb.conf.5.html#MAXOPENFILES

The limit of the number of open files is usually set by the UNIX per-process file descriptor limit rather than this parameter so you should never need to touch this parameter.

and

On another machine I tried setting only the override in the service file, and this appears to be enough. But on this one I don’t use smb shares, it’s my backup, so smbd runs without users.
Where I actually use SMB shares, no matter what I did the limit remained 16k until I also changed the hidden smb_options parameter.