Optimal SAMBA settings to get better MacOS to Unraid performance


ChannelD

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
  • 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
  • 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

 

 

  • Like 1
  • Thanks 1
Link to comment
  • 2 weeks later...

So I have tried this, simply making a fresh truenas VM within Unraid with base settings is insane fast and works out of the box, has anyone else got the time to confirm and spin up a Truenas VM, It must be something in the OS, we should NOT need a million settings to get better performance

Edited by Nano
  • Like 1
Link to comment
  • 3 weeks later...

 I finally have a working FTP connection with my UnRaid NAS where the Mac is not treated as a read only device. The client I used allows me to browse and transfer files at almost the capacity of the network. Speeds are consistently high. This could be a viable alternative to using SAMBA. 
 

Link to comment

Thanks @ChannelDfor posting above. 

 

I have two macs, Intel and M2, both on Sonoma.  I've applied all the settings to Unraid extras. The M2 works fine with the first nsmb.conf (it did not prior to these changes).  The intel doesn't.  I moved the intel to the updated config and my problem remains.  They are both wired on the same LAN but the intel keeps getting "interrupted by a network problem".  I can assure everyone that the share is still there and working. I don't use SMB for anything but the time machine backup. I can't find anything in the logs or console which I find strange.  Anyone have any thoughts on what else I can do to troubleshoot/modify? 

Link to comment

I discovered a bunch of .fuse-hidden files that couldn't be rm -rf .*  so I stopped and then started the array and was able to remove all the files in the share. Hoping this line of thought helps others. Currently time machine is backing up. It's quite possible that I assumed that rm -rf * worked and in fact left a sparse bundle around.

Link to comment
  • 1 month later...

Has anyone been able to make this work with Carbon Copy Cloner 6 (ccc) and MacOS 12 or 13?

Just want a simple way to backup to sparseimage or sparseimage, so far it's been torture.

I all works great with CCC5 and older MacOS, 10,12 and 10,13.

Link to comment
  • 3 weeks later...
On 12/16/2023 at 5:29 PM, Nano said:

So I have tried this, simply making a fresh truenas VM within Unraid with base settings is insane fast and works out of the box, has anyone else got the time to confirm and spin up a Truenas VM, It must be something in the OS, we should NOT need a million settings to get better performance

I am one of those unfortunate souls that has been trying to get this to work for a long time. I have tried using a share name, using just whole disk, using the fruit args at boot up and the results were the same.   I would get the initial backup and subsequent attempts would just failed no matter what I did. I tried wired and wifi same outcome. I finally gave up and bough a Time Capsule and that's been working like a charm. Then I read @Nano post of using truenas in vm. After many years of trying to have a stable backup  I said why not, I am not losing anything since the time capsule is working.

 

 The verdict, it has not failed once to backup, I am backing up 3 macs no problem to the truenas scale share.  Furthermore to test,  I used Carbon Copy cloner, it had the same issue as the time machine it would do the first one and then fail afterwards. With CCC the backups sometimes took days, days!!.  With Scale first backup took 3 hours and subsequent backups take maybe 15 to 30 minutes. It has not once failed.

 

Whoever posted that whatever implementation of SMB unraid using is crap is very true, I love unraid but this is major dirty stain.  Am i going to move to Truenas? nope but I am damn sure going to will keep truenas vm going.

 

I've always said, why would Tom pick slackware as a base for unraid after it became apperant that slackware was not going to be a debian or arch but I am an end user after all and what i used it for it works.

Link to comment
  • 2 weeks later...

So I am very new to unraid, but this is troubling.  Should I keep my old Synology around to be able to timemachine backup to? 

 

And even after reading all of these threads, there are so many options...I don't know what to implement. I'm on Sonoma with an M3 mac.  I use my NAS to archive all of my photos, so speed is obviously important.  

 

What changes above are the ones for my situation? Are intel and arm treated differently?

Link to comment

6.10.

1 hour ago, rickeames said:

timemachine backup to

6.12.8+ was a revamp of the settings for TimeMachine.

 

Prior to 6.12.8 you could get TM to fail on Unraid no problem, and it would intermittently fail for apparently no reason at all.

 

6.12.8+ I was completely unable to manage to get TM to ever fail, no matter what I did 

Link to comment
17 hours ago, Squid said:

6.10.

6.12.8+ was a revamp of the settings for TimeMachine.

 

Prior to 6.12.8 you could get TM to fail on Unraid no problem, and it would intermittently fail for apparently no reason at all.

 

6.12.8+ I was completely unable to manage to get TM to ever fail, no matter what I did 

 

 I had issues in 6.12.8 but after awhile I gave up on time machine to unraid, I the time capsule many lest that a month ago and it works.

@rickeames  I would try setting up following the guide maybe you will have better luck.

Link to comment

if i have multiple shares, some native windows, do you see any conflicts with the unraid specific ones and those?  specifically from the changes to the mac nsmb.conf file?

Edited by oliver
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.