Optimal SAMBA settings to get better MacOS to Unraid performance


Recommended Posts

In the Mac's /etc directory I created the file nsmb.conf. In that file I used the following settings:

[default]
signing_required=no    <--- to match Unraid's setting 6.12.4
aapl_off=true
max_resp_timeout=600
mc_prefer_wired=yes
mc_on=yes            <--- to match Unraid's setting 6.12.4
#notify_off=yes
#file_ids_off=yes
#dir_cache_off=yes

You need to have root permissions or be able to use sudo to save this file.

This is for MacOS Sonoma 14.0.

I have seen a good practical improvement over the out of the box settings  (Unraid + Mac not having this file to begin with) in the weeks I have set up a MacPro 4,1 with Unraid.

Interested in hearing what you have for your settings.

 

Settings to change in UnRaid's setting for SMB extra configurations, add (thanks to @faxxe71) the following:

 

veto files = /._*/.DS_Store/

aio read size = 1

aio write size = 1

strict locking = No

use sendfile = No

server multi channel support = Yes

readdir_attr:aapl_rsize = no

readdir_attr:aapl_finder_info = no

readdir_attr:aapl_max_access = no

fruit:posix_rename = yes

fruit:metadata = stream

 

Also these and more setting explained here: https://wiki.samba.org/index.php/Configure_Samba_to_Work_Better_with_Mac_OS_X

 

I was not aware of SAMBA Mac issues when researching Unraid. So when I set up my Unraid MacPro and starting testing it with my Macs, I was very disappointed with Unraid (and it is not being Unraid's fault).

Edited by ChannelD
  • Like 1
Link to comment
  • 2 weeks later...

Trying to upgrade to at least unRAID 6.10.3 from 6.9.2 and had to revert back to 6.9.2 due to extremely slow SMB. It was taking about 35 minutes instead of 7 minutes to read, from unRAID, around 2300 file names into EyeTV on a MacMini running OS 10.12...so if this works it would be great.

You mention here creating a file on the Mac called nsmb.conf but in the video it is called smb.conf. Not sure which it should be.

Also some of the setting here refer to unRAID v 6.12.4, are these the same settings for v6.10.3, 6.11.x or are they different?

I have a number of Macs running various versions of OSX because of expensive software running on them only one has a OS higher than 10.12, does that make a difference on the settings?

Things worked great when AFP was included in unRAID but went down hill when that was dropped even though it is still viable with Mac OS.

Link to comment

The file is called nsmb.conf. The MacOS used for the above settings is Sonoma.  Unraid 6.12.4.  The settings above may not be optimal for the OS so there could be a need to experiment.  Still a lot better than out of the box. This thread is to try to summarise in one place the optimal settings. As for earlier versions of unraid and how that factors in is not known at moment.  The settings now appear to depend on:

* MacOS

* Settings in the Mac’s nsmb.conf file

* Unraid version 

* Unraid’s smb extras configuration

Unfortunately a wide set of variables. Would be good to narrow this down again. 

Edited by ChannelD
Link to comment

I can confirm that these settings do work with Mac OS Sierra/10.12 and unRAID 6.10.3, 6.11.5 and 6.12.4, and are working on 2 servers and 2 Macs, 2012 Mac Mini and 2011 iMac.

EyeTV startup is now back to 7 minutes reading over 2300 files on 6 array disks instead of 35 minutes from a Mac Mini  and Carbon Copy Cloner (CCC) is once again a joy to use when backing up My Mac to unRAID taking minutes instead of hours previously.. Thanks for posting this.

Edited by Russ Uno
Added Mac Models.
Link to comment

Good to hear another confirmation that the settings described above are a step in the right direction. 
Since UnRaid news published a link to my video on my optimal samba settings I’ll leave a link to it here. If this is breaking any rules I’ll happily remove it. 

 

Edited by ChannelD
  • Like 1
Link to comment

Just wanted to offer a word of thanks for putting this together. I had a reasonable SMB extras config, but hadn't done the nsmb.conf on the Mac side, and the combination is helping with some large directory issue I've been dealing with in a couple of cases. So - thanks - great work!

  • Like 1
Link to comment
  • JorgeB pinned this topic
  • 2 weeks later...

Thanks for posting this.

 

Some time ago whilst on Ventura I spent time messing around with fruits config in /boot/config/smb-fruit.conf

I'm mostly transferring or streaming large video files between unraid smb on a HP proliant and macbook pro over wifi. Also store my jpeg and RAW image files on the unraid for viewing/processing on the macbook

I peaked file transfer performance for both folders containing multiple image files and large video files. With the below config in smb-fruit.conf. No nsmb.conf on the mac and nothing in /boof/config/smb-extra.conf.


vfs objects = catia fruit streams_xattr

fruit:resource = file

fruit:metadata = stream

fruit:encoding = native
fruit:posix_rename = yes
readdir_attr:aapl_rsize = no
readdir_attr:aapl_finder_info = no
readdir_attr:aapl_max_access = no
fruit:wipe_intentionally_left_blank_rfork = yes
fruit:delete_empty_adfiles = yes

 

Large files will maintain 95MB/s up or down over ax 80MHz wifi when my local wifi neighbourhood is quiet and will maintain 102MB/s on LAN. Just below the max read/write capability of my unraid machine.

Good compatibility with no random file permission/ access errors. No apple doubles. Fast response when opening folders with multiple files.

 

All was well right up to macos 13.6.2. Fresh install of Sonoma 14.1.1 over the weekend and now I have an issue with jpeg files opened on the macbook with Preview from the smb share. Randomly some of them will corrupted. Open with a 3rd party image viewer and they're fine. Copy locally and they open fine with Preview.

I see the issue has been raised by multiple people with apple support so it seems to be a bug with either Preview or their current implementation of smb.

 

I've tried the various fix suggestions, adding various parameters to nsmb.conf, smb-fruit.conf and smb-extra.conf along with including ChannelD's recommendations.

Nothing has worked. Also transfer speeds where down to around 70MB/s over LAN with ChannelD's config.

 

Anyone had any success resolving this issue. I don't much fancy rolling back to Ventura but not sure I can live with this ..

Edited by fka
Link to comment

@fka All was going well until sonoma 14.1.1. My transfer speeds and response times for drag dropping FCPX has dropped noticeably. Investigating atm but so far no luck with tweaks I have found and made. A plan to follow up very soon on my findings. 

Link to comment
  • 2 weeks later...

My new Mac nsmb.conf file.  Note the order of the parameters is important on my Intel MacPro with Sonoma 14.1.1.  Recovered some performance but not like it was before Sonoma 14.1.1.  I have made a new video on my findings to date and how to handle SMB better.

 

Mac nsmb.conf file:

 

[default]

# /etc/nsmb.conf - macOS 11.3+

#-----------------------------------------------------------------------------

# Additional information:

# -----------------------

# https://support.apple.com/de-de/HT211927

# https://support.apple.com/en-us/HT208209

# https://apple.stackexchange.com/questions/309016/smb-share-deadlocks-since-high-sierra

# https://photographylife.com/afp-vs-nfs-vs-smb-performance

# https://support.apple.com/de-de/HT212277

# https://www.synoforum.com/threads/mac-clients-smb-cache-issues.7009/page-3

# UnRaid SMB extra configurations:

# https://wiki.samba.org/index.php/Configure_Samba_to_Work_Better_with_Mac_OS_X

# https://www.samba.org/samba/docs/current/man-html/vfs_fruit.8.html

#

# To speed up SMB file browsing, you can prevent macOS from reading .DS_Store files on

# SMB shares. This makes the Finder use only basic information to immediately display

# each folder's contents in alphanumeric order.

# defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool TRUE

# log out of your macOS account and log back in to apply

#------------------------------------------------------------------------------

 

# Use NTFS streams if supported (Macs use two streams per file - ADS or "multi-fork")

streams=yes

 

# Set hard or soft mount of shares

# Hard mount: a request is issued repeatedly until the request is satisfied

# Soft mount: tried until completed, the retry limit is met or the timeout limit is met

# Soft mount by default

soft=yes

 

# Disable packet signing to improve performance as no security issue on secure (non-infiltrated) network.

# Note this is off by default from macOS 10.13.4 onwards although this is ambiguous (Apple HT205926)

signing_required=no

 

# Disable directory caching (ensures Finder folder contents display is up to date)

dir_cache_off=yes

 

# Disable local SMB caching

# Can be set and then unset to clear SMB cache

dir_cache_max_cnt=0

 

# Ensure desired SMB level and prevent SMB 1 (Apple HT211927)

# Lock negotiation to SMB2/3 only

# 7 == 0111  SMB 1/2/3 should be enabled

# 6 == 0110  SMB 2/3 should be enabled

# 4 == 0100  SMB 3 should be enabled

protocol_vers_map=6

 

# No SMB1 = no NetBIOS (WINS) and it should be disabled

port445=no_netbios

 

# Turn off change notifications (Finder maintains folder list integrity)

# notify_off=yes

 

# SMB Multichannel behaviour (Apple HT212277)

# Disable multichannel support because only one wired network connection

mc_on=yes

 

# Prefer wired networks over Wi-Fi networks that may advertise faster speeds than appropriate

mc_prefer_wired=yes

 

# Remember, after editing and saving with VI, to log out of macOS account and log back in again for the new settings to load

 

 

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.