• MacOS Optimization


    limetech
    • Minor

    Starting with 6.11.0-rc5 we have added some features to help us figure out the proper mix of SMB settings which will achieve the best performance/functionality with MacOS.  This mainly involves tuning the so-called "fruit" SMB parameters.  Please refer to the Samba "vfs_fruit" doc:

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

     

    First you will notice there are Global options and Per-Share options.  The global options are set in /etc/samba/smb.conf file on your server.  All the options are listed near the bottom, and ones which vary from the default setting are uncommented.  I don't think we will need to change these options but if you want to experiment then add your changes to /boot/config/smb-extra.conf file.

     

    Next are the set of per-share options.  These are set in /etc/samba/smb-fruit.conf file on your server.  Again all options are listed there and only the ones which deviate from default are uncommented.

     

    In addition, you may create the file /boot/config/smb-fruit.conf on your flash device and when Samba starts or is restarted, those options will override the options in /etc/samba/smb-fruit.conf.  Thus a good staring point would be to:

    cp /etc/samba/smb-fruit.conf /boot/config

    and now you can make changes to /boot/config/smb-fruit.conf

    After making a change you can type this command to to restart Samba:

    samba restart

     

    For any of this to be applied, you first need to ensure that "Settings/SMB/Enhanced macOS interoperability" is set to Yes.  This will tell Unraid OS to include the contents of the smb-fruit.conf file in each share (except for the 'flash' share, see below).

     

    Note: we actually have per-share hidden settings for enabling 'fruit', however from the documentation we read:

    Quote

    Be careful when mixing shares with and without vfs_fruit. OS X clients negotiate SMB2 AAPL protocol extensions on the first tcon, so mixing shares with and without fruit will globally disable AAPL if the first tcon is without fruit.

     

    Thus there is no UI for these settings, instead either all shares or no shares have 'fruit' extensions.  As for the 'flash' share, again from the doc we read:

    Quote

    The module enables alternate data streams (ADS) support for a share, intercepts the OS X special streams "AFP_AfpInfo" and "AFP_Resource" and handles them in a special way. All other named streams are deferred to vfs_streams_xattr which must be loaded together with vfs_fruit.

    (emphasis mine).

     

    They say 'streams_xattr' must be loaded, but later in the doc they talk about options that are incompatible with this.  In addition certain file system types are inherently incompatible, notably FAT and exFAT because they don't support xattr at all...  Hence we can't (or shouldn't) include the 'flash' share in 'fruit' but then if the 'flash' share is first share to be accessed on a Mac client, APPL extensions will be disabled for the duration... Yes this is confusing, maybe best bet is to not export the 'flash' share in MacOS environment.  If it is exported, the 'testparm' command outputs this warning:

    WARNING: some services use vfs_fruit, others don't. Mounting them in conjunction on OS X clients results in undefined behaviour.

     

    Time machine - if enabled for a share these parameters are automatically added (independent of smb-fruit.conf):

    fruit:time machine = yes
    fruit:time machine max size = SIZE # if "vol size limit" specified

     

    Finally Spotlight - our build of Samba includes spotlight support but only for 'elasticsearch'.  But 'elasticsearch' is not installed in Unraid OS.  In other places on the forum people have expressed success by setting the spotlight backend to 'tracker' - but this requires "gnone tracker" which also is not installed in Unraid OS - so I'm not sure what's going on here.  Nevertheless, you can add 'spotlight = on' to the smb-fruit.conf file to play around with this.

     

    Please limit discussion in this topic to MacOS issues only.

     

    • Like 10
    • Thanks 1
    • Upvote 1



    User Feedback

    Recommended Comments



    Great to see. Hopefully this will help correct the Time Machine incompatibilities many people are seeing after 6.10. More details in 

     and 

     

    Link to comment

    Is MacOS SMB a recent regression or has it always been an issue? If recent is the regression on the Unraid side or is this something related to more recent MacOS versions or M1 and later hardware?

    Link to comment

    When you add extra setting to the - SETTINGS/SMB/SMB Extras

     

    Are these being saved to the /etc/samba/smb.conf or /boot/config/smb-extra.conf ?

     

    What settings should be used as starting point?

     

    Is the list below a good starting point?

     

    #unassigned_devices_start

    #Unassigned devices share includes

       include = /tmp/unassigned.devices/smb-settings.conf

    #unassigned_devices_end

     

    [global]

       vfs objects = catia fruit streams_xattr

       fruit:nfs_aces = no

       fruit:zero_file_id = yes

       fruit:metadata = stream

       fruit:encoding = native

     

    [share_name]

       path = /mnt/user/"share_name"

       spotlight = on

     

     

    ------------------------------

    *Please note: do not use spaces in share name or mover will not move the files from the array back to the cache pool.

    • Like 1
    Link to comment
    18 minutes ago, wow001 said:

    When you add extra setting to the - SETTINGS/SMB/SMB Extras

     

    Are these being saved to the /etc/samba/smb.conf or /boot/config/smb-extra.conf ?

     

    In the smb-extra.conf file.

     

    If you look at the /etc/samba/smb.conf  file, you will find that the smb-extra.conf file is 'included' as a command in the that file.    (As I recall, all of the commands/parameters in the smb.conf are 'executed' in order that they occur in the processing of smb.conf.   Thus, if a parameter occurs twice, the second one is the one enforced.)  To see the complete contents of smb.conf, use the following command in the GUI terminal :

    cat /etc/samba/smb.conf 

     

    Link to comment

    Hi there!

     

    I try added to smb-extra.conf the config used berfore : 

    [global]
       vfs objects = catia fruit streams_xattr
       fruit:nfs_aces = no
       fruit:zero_file_id = yes
       fruit:metadata = stream
       fruit:encoding = native

     

    But it causes a crash : 

    Sep 18 20:18:56 Vili  smbd[22056]: [2022/09/18 20:18:56.939499,  0] ../../lib/cmdline/cmdline.c:56(_samba_cmdline_talloc_log)
    Sep 18 20:18:56 Vili  smbd[22056]:   talloc: access after free error - first free may be at ../../tevent_req.c:291
    Sep 18 20:18:56 Vili  smbd[22056]: [2022/09/18 20:18:56.939544,  0] ../../lib/cmdline/cmdline.c:56(_samba_cmdline_talloc_log)
    Sep 18 20:18:56 Vili  smbd[22056]:   Bad talloc magic value - access after free
    Sep 18 20:18:56 Vili  smbd[22056]: [2022/09/18 20:18:56.939560,  0] ../../lib/util/fault.c:172(smb_panic_log)
    Sep 18 20:18:56 Vili  smbd[22056]:   ===============================================================
    Sep 18 20:18:56 Vili  smbd[22056]: [2022/09/18 20:18:56.939574,  0] ../../lib/util/fault.c:173(smb_panic_log)
    Sep 18 20:18:56 Vili  smbd[22056]:   INTERNAL ERROR: Bad talloc magic value - access after free in pid 22056 (4.16.5)
    Sep 18 20:18:56 Vili  smbd[22056]: [2022/09/18 20:18:56.939589,  0] ../../lib/util/fault.c:177(smb_panic_log)
    Sep 18 20:18:56 Vili  smbd[22056]:   If you are running a recent Samba version, and if you think this problem is not yet fixed in the latest versions, please consider reporting this bug, see https://wiki.samba.org/index.php/Bug_Reporting
    Sep 18 20:18:56 Vili  smbd[22056]: [2022/09/18 20:18:56.939604,  0] ../../lib/util/fault.c:182(smb_panic_log)
    Sep 18 20:18:56 Vili  smbd[22056]:   ===============================================================
    Sep 18 20:18:56 Vili  smbd[22056]: [2022/09/18 20:18:56.939617,  0] ../../lib/util/fault.c:183(smb_panic_log)
    Sep 18 20:18:56 Vili  smbd[22056]:   PANIC (pid 22056): Bad talloc magic value - access after free in 4.16.5
    Sep 18 20:18:56 Vili  smbd[22056]: [2022/09/18 20:18:56.939720,  0] ../../lib/util/fault.c:245(log_stack_trace)
    Sep 18 20:18:56 Vili  smbd[22056]:   BACKTRACE:
    Sep 18 20:18:56 Vili  smbd[22056]:    #0 log_stack_trace + 0x39 [ip=0x14d1de0fc159] [sp=0x7ffc6061a920]
    Sep 18 20:18:56 Vili  smbd[22056]:    #1 smb_panic + 0x9 [ip=0x14d1de0fc4c9] [sp=0x7ffc6061b260]
    Sep 18 20:18:56 Vili  smbd[22056]:    #2 <unknown symbol> [ip=0x14d1de020af8] [sp=0x7ffc6061b270]
    Sep 18 20:18:56 Vili  smbd[22056]:    #3 fsp_set_fd + 0x46b8 [ip=0x14d1de437e48] [sp=0x7ffc6061b2a0]
    Sep 18 20:18:56 Vili  smbd[22056]:    #4 tevent_common_invoke_immediate_handler + 0x17a [ip=0x14d1de00dcfa] [sp=0x7ffc6061b2d0]
    Sep 18 20:18:56 Vili  smbd[22056]:    #5 tevent_common_loop_immediate + 0x16 [ip=0x14d1de00dd16] [sp=0x7ffc6061b330]
    Sep 18 20:18:56 Vili  smbd[22056]:    #6 tevent_wakeup_recv + 0xf5b [ip=0x14d1de013a7b] [sp=0x7ffc6061b340]
    Sep 18 20:18:56 Vili  smbd[22056]:    #7 tevent_signal_get_tag + 0xb7 [ip=0x14d1de011d77] [sp=0x7ffc6061b3a0]
    Sep 18 20:18:56 Vili  smbd[22056]:    #8 _tevent_loop_once + 0x91 [ip=0x14d1de00cb61] [sp=0x7ffc6061b3c0]

     

    Anybody has this issue and a possible fix?

    Thanks!

     

    [edit : ] the crash occurs when trying to start a timemachine backup

    Edited by foux
    Link to comment

    So far,

    I have removed all the extras setting. Settings as displayed in the attached image.

    For the first time I am able to copy files from the Mac 12.6 to Unraid 6.11.0-rc5 without the finder on the Mac crashing

    and completing the copy. (1.2Gb takes 20seconds on 1GB network to nvme cache pool)

    Also searching in a share is also working without any smb extras, takes 1-2 minutes before any results show.

    (Share is on a nvme cache pool)

     

    Screenshot 2022-09-19 at 13.07.29.png

    • Like 2
    Link to comment

    For me, without any additional settings, TimeMachine is working "as before" : ie first backup works without issues. Then the first few backups works, and suddenly impossible to create additional backups (macOS can't mount the backup image)

    Link to comment
    12 minutes ago, wow001 said:

    So far,

    I have removed all the extras setting. Settings as displayed in the attached image.

    A Note to all you are following this:

     

    You don't have to edit/delete any settings that you have added into your smb-extra configuration.  You can just put a    #    in front of any parameter and that will cause the parameter to become a "comment"--- basically a text statement that is often used to explain the purpose of a parameter. 

     

    You can also use the comment trick to evaluate which ones of a number of parameters actually improve things in your situation.  (Sometimes, smb parameter settings fix things that are edge case conditions but they can also introduce other side effects.)

    • Like 1
    Link to comment
    On 9/18/2022 at 7:04 AM, wow001 said:

    *Please note: do not use spaces in share name or mover will not move the files from the array back to the cache pool.

    This is fixed in next release...

    • Like 1
    Link to comment
    4 hours ago, foux said:

    For me, without any additional settings, TimeMachine is working "as before" : ie first backup works without issues. Then the first few backups works, and suddenly impossible to create additional backups (macOS can't mount the backup image)

    Need diags when this happens.

    Link to comment
    On 9/18/2022 at 7:04 AM, wow001 said:

    [global]

       vfs objects = catia fruit streams_xattr

     

    In general you DO NOT want this line in the [global] section  because if you add a plugin which needs to stack a share-level module (such as the Recycle Bin plugin) then the presence of 'vfs objects' at the share level supersedes the setting in the [global] section.  Besides that exact string is already included in every share section.

     

    • Thanks 1
    Link to comment
    On 9/18/2022 at 7:04 AM, wow001 said:

    [global]

       vfs objects = catia fruit streams_xattr

       fruit:nfs_aces = no

       fruit:zero_file_id = yes

       fruit:metadata = stream

       fruit:encoding = native

     

    Please try

    fruit:metadata = netatalk

     

    or comment out that line (default for that value is 'netatalk')

     

    Link to comment
    1 hour ago, limetech said:

    Need diags when this happens.

    What kind of information do you need? (There is another thread here in the forum with many logs…)

    • Like 1
    Link to comment
    9 minutes ago, limetech said:

    Tools/Diagnostics  - update the diagnostics.zip file for the -rc release with which crashes occur.

    I have no access to my Unraid system right now, but I can do that in a few days. 
     

    But at least in my case there was nothing in Unraid logs and I tried with standard configuration. (I am a new Unraid user, already had that problem right after setting up the server, after the initial Timemachine backup.)

    • Like 1
    Link to comment
    On 9/18/2022 at 2:34 PM, foux said:

    Hi there!

     

    I try added to smb-extra.conf the config used berfore : 

    [global]
       vfs objects = catia fruit streams_xattr
       fruit:nfs_aces = no
       fruit:zero_file_id = yes
       fruit:metadata = stream
       fruit:encoding = native

     

    But it causes a crash : 

    Sep 18 20:18:56 Vili  smbd[22056]: [2022/09/18 20:18:56.939499,  0] ../../lib/cmdline/cmdline.c:56(_samba_cmdline_talloc_log)
    Sep 18 20:18:56 Vili  smbd[22056]:   talloc: access after free error - first free may be at ../../tevent_req.c:291
    Sep 18 20:18:56 Vili  smbd[22056]: [2022/09/18 20:18:56.939544,  0] ../../lib/cmdline/cmdline.c:56(_samba_cmdline_talloc_log)
    Sep 18 20:18:56 Vili  smbd[22056]:   Bad talloc magic value - access after free
    Sep 18 20:18:56 Vili  smbd[22056]: [2022/09/18 20:18:56.939560,  0] ../../lib/util/fault.c:172(smb_panic_log)
    Sep 18 20:18:56 Vili  smbd[22056]:   ===============================================================
    Sep 18 20:18:56 Vili  smbd[22056]: [2022/09/18 20:18:56.939574,  0] ../../lib/util/fault.c:173(smb_panic_log)
    Sep 18 20:18:56 Vili  smbd[22056]:   INTERNAL ERROR: Bad talloc magic value - access after free in pid 22056 (4.16.5)
    Sep 18 20:18:56 Vili  smbd[22056]: [2022/09/18 20:18:56.939589,  0] ../../lib/util/fault.c:177(smb_panic_log)
    Sep 18 20:18:56 Vili  smbd[22056]:   If you are running a recent Samba version, and if you think this problem is not yet fixed in the latest versions, please consider reporting this bug, see https://wiki.samba.org/index.php/Bug_Reporting
    Sep 18 20:18:56 Vili  smbd[22056]: [2022/09/18 20:18:56.939604,  0] ../../lib/util/fault.c:182(smb_panic_log)
    Sep 18 20:18:56 Vili  smbd[22056]:   ===============================================================
    Sep 18 20:18:56 Vili  smbd[22056]: [2022/09/18 20:18:56.939617,  0] ../../lib/util/fault.c:183(smb_panic_log)
    Sep 18 20:18:56 Vili  smbd[22056]:   PANIC (pid 22056): Bad talloc magic value - access after free in 4.16.5
    Sep 18 20:18:56 Vili  smbd[22056]: [2022/09/18 20:18:56.939720,  0] ../../lib/util/fault.c:245(log_stack_trace)
    Sep 18 20:18:56 Vili  smbd[22056]:   BACKTRACE:
    Sep 18 20:18:56 Vili  smbd[22056]:    #0 log_stack_trace + 0x39 [ip=0x14d1de0fc159] [sp=0x7ffc6061a920]
    Sep 18 20:18:56 Vili  smbd[22056]:    #1 smb_panic + 0x9 [ip=0x14d1de0fc4c9] [sp=0x7ffc6061b260]
    Sep 18 20:18:56 Vili  smbd[22056]:    #2 <unknown symbol> [ip=0x14d1de020af8] [sp=0x7ffc6061b270]
    Sep 18 20:18:56 Vili  smbd[22056]:    #3 fsp_set_fd + 0x46b8 [ip=0x14d1de437e48] [sp=0x7ffc6061b2a0]
    Sep 18 20:18:56 Vili  smbd[22056]:    #4 tevent_common_invoke_immediate_handler + 0x17a [ip=0x14d1de00dcfa] [sp=0x7ffc6061b2d0]
    Sep 18 20:18:56 Vili  smbd[22056]:    #5 tevent_common_loop_immediate + 0x16 [ip=0x14d1de00dd16] [sp=0x7ffc6061b330]
    Sep 18 20:18:56 Vili  smbd[22056]:    #6 tevent_wakeup_recv + 0xf5b [ip=0x14d1de013a7b] [sp=0x7ffc6061b340]
    Sep 18 20:18:56 Vili  smbd[22056]:    #7 tevent_signal_get_tag + 0xb7 [ip=0x14d1de011d77] [sp=0x7ffc6061b3a0]
    Sep 18 20:18:56 Vili  smbd[22056]:    #8 _tevent_loop_once + 0x91 [ip=0x14d1de00cb61] [sp=0x7ffc6061b3c0]

     

    Anybody has this issue and a possible fix?

    Thanks!

     

    [edit : ] the crash occurs when trying to start a timemachine backup

    Yes I have the same issue, I made a bug report about it

     

    Edit: I tested with and without SMB Extras present and same results, time machine fails and log entries indicate a smb crash.

    Edited by Jclendineng
    Link to comment

    That's not an appropriate way to do the MacOS settings.  The vfs_ojects can be overwritten by a plugin - the Recycle Bin will eliminate the vfs_objects when it does it's work when you do it this way.

     

    Read the first post on how to copy the smb-fruit.conf file to the flash device and how to make changes there that will be applied correctly to the Unraid shares.

     

    In the next rc there is a share setting for time machine volume size limit:

    Screenshot 2022-09-20 142333.png

     

     

    • Thanks 1
    Link to comment

    For those with macOS issues - please do not put anything related to "fruit" settings in config/smb-extra.conf. 

    That file will set "global settings" and the fruit stuff needs to be per-share.  Only create/modify config/smb-fruit.conf if you want to experiment with non-default settings.

     

    Also, please set your 'flash' export setting to No if running 6.11.0 or earlier.  Once 6.11.1 is published you should be able to re-export 'flash' share if you want (though not recommended).

    Link to comment
    44 minutes ago, limetech said:

    For those with macOS issues - please do not put anything related to "fruit" settings in config/smb-extra.conf. 

    That file will set "global settings" and the fruit stuff needs to be per-share.  Only create/modify config/smb-fruit.conf if you want to experiment with non-default settings.

    What would be the recommended way to apply the fruit settings to every share? Do I need to add every share to smb-fruit.conf?

    Link to comment
    38 minutes ago, wgstarks said:

    What would be the recommended way to apply the fruit settings to every share? Do I need to add every share to smb-fruit.conf?

    If config/smb-fruit.conf exists then it is added to the settings for every share automatically, else the contents of /etc/samba/smb-fruit.conf is added to every share automatically.

     

    You can examine after array Started with this command:

     

    testparm -sv

     

    In upcoming 6.11.1 the 'flash' share is omitted from this treatment, instead the 'fruit' settings for that share are fixed - this is because the USB flash using vfat filesystem.

    Link to comment

    Copy the /etc/samba/smb-fruit.conf to /flash/config/smb-fruit.conf.  Then make changes to the /flash/config/smb-fruit.conf file.  After making changes, you need to restart samba:

    /etc/rc.d/rc.samba restart

     

    You need to make changes to the copied smb-fruit.conf because it contains the "vfs objects = catia fruit streams_xattr".  You'll see uncommented lines.  Those are the defaults.  The commented lines are lines you can uncomment to try out different settings.

    Link to comment

    Should I delete my mac compatibility global settings from boot/config/smb-extra.conf?

     

    #unassigned_devices_start
    #Unassigned devices share includes
       include = /tmp/unassigned.devices/smb-settings.conf
    #unassigned_devices_end
    #vfs_recycle_start
    #Recycle bin configuration
    [global]
       syslog only = Yes
       syslog = 0
       logging = 0
       log level = 0 vfs:0
    #vfs_recycle_end
    #mac compatibility start
       fruit:metadata = stream
       fruit:posix_rename = yes
       readdir_attr:aapl_max_access = no
       readdir_attr:aapl_finder_info = no
       readdir_attr:aapl_rsize = no
       spotlight = on

     

    And then paste this into smb-fruit.conf?

     

    #mac compatibility start
    [global]
       fruit:metadata = stream
       fruit:posix_rename = yes
       readdir_attr:aapl_max_access = no
       readdir_attr:aapl_finder_info = no
       readdir_attr:aapl_rsize = no
       spotlight = on

     

    I tried a few days ago to just use default settings (no mac compatibility settings configured in extras) but lost access to all shares so decided to return settings to the previous working set in the first section.  spotlight = on was just added because it was suggested by LT but doesn't seem to have any effect (he said it probably wouldn't). I just haven't removed it yet.

    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
    Add a comment...

    ×   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.


  • Status Definitions

     

    Open = Under consideration.

     

    Solved = The issue has been resolved.

     

    Solved version = The issue has been resolved in the indicated release version.

     

    Closed = Feedback or opinion better posted on our forum for discussion. Also for reports we cannot reproduce or need more information. In this case just add a comment and we will review it again.

     

    Retest = Please retest in latest release.


    Priority Definitions

     

    Minor = Something not working correctly.

     

    Urgent = Server crash, data loss, or other showstopper.

     

    Annoyance = Doesn't affect functionality but should be fixed.

     

    Other = Announcement or other non-issue.