in How To's, macOS, Synology

macOS Finder has been notoriously slow handling some Samba file shares, and Synology users are well aware of this.

The most common issue is the non-existent activation of the vfs_fruit Samba module for SMB3.x connections on Synology NAS’. In order to activate this module, you’ll need to SSH your NAS and change the smb.conf file in accordance.

Warnings

# Warning 1: make sure you know what you’re doing while using SSH. If you don’t use it often, disable it after use.

# Warning 2: This change is not permanent, but it does persist after changes made to SMB settings via DSM UI. It may not be persistent after updates.

# Warning 3: Please understand that Synology does not support this out-of-the-box probably because it is untested. Take that in mind.

# WarningĀ 4: This may affect Time Machine backups – to be confirmed.

Updated: a Simpler Way

Below are TL:DR instructions; to understand what is happening do read the rest of the article, but this method works just fine, although it doesn’t run on boot (can’t say why, though). You’ll have to run it manually using Task Scheduler after reboot for now.

This method also assumes that you’re not using NETBIOS, but applying the changes directly to the main smb.conf file should probably work as well (untested).

This method is done by using only DSM > Control Panel > Task Scheduler. Create a new “Triggered Task“, the user as “root” and select “Boot-Up” as the trigger. Give this task a descriptive name:

Check “Enabled” Select the “Task Settings” tab and paste the following script in the script box:

#!/bin/sh

# Stop Samba
/usr/syno/sbin/synoservicecfg --stop samba

# Create the new conf file
sudo echo "vfs objects = fruit
fruit:aapl = yes
fruit:encoding = native
fruit:locking = none
fruit:metadata = stream
fruit:resource = file" >> /var/tmp/nginx/smb.netbios.aliases.conf

# Start Samba
/usr/syno/sbin/synoservicecfg --start samba

Also note that upon restart SMB shares will be available using default configurations and only by the end of the boot process the new configuration will be applied and the Samba service rebooted.


Understanding what’s going on

You’ll need elevated privileges from hereon, so issue sudo -i after initiating you SSH session.

Editing smb.conf

While trying to make this work, I’ve found that if you change the global /etc/samba/smb.conf file, by adding the parameters below, those will be all messed up after any changes are made to SMB settings via DSM UI.

Although it probably won’t matter, I’m using a workaround by placing these configuration parameters not in the main file, but in a file that it includes by default and that is [probably] not being used if you’re not using Netbios (it wasn’t in my case). This file is /var/tmp/nginx/smb.netbios.aliases.conf, that you can see in my default smb.conf file:

[global]
printcap name=cups 
winbind enum groups=yes 
include=/var/tmp/nginx/smb.netbios.aliases.conf
min protocol=SMB2 
security=user
local master=no
realm=*
passdb backend=smbpasswd
printing=cups
max protocol=SMB3
winbind enum users=yes
load printers=yes
workgroup=WORKGROUP

This way, this will survive SMB settings edits and hopefully also DSM upgrades. So, in order to this, create the missing included conf file:

touch /var/tmp/nginx/smb.netbios.aliases.conf

Open it up with VIM (note: this is not a common text editor, if you have never used it before, search for a how-to online):

vim /var/tmp/nginx/smb.netbios.aliases.conf

When VIM opens, press i to enable text entry and paste the required parameters, listed below:

vfs objects = fruit
fruit:aapl = yes
fruit:encoding = native
fruit:locking = none
fruit:metadata = stream
fruit:resource = file

Press Escape to exit editing mode, type in :wq to write and quit VIM. Then check if it looks ok:

Advertisement

cat /var/tmp/nginx/smb.netbios.aliases.conf

Restarting the SMB service

After editing the .conf file above, issue this to restart the Samba server:

synoservicecfg --restart samba

You may also look into the log and check if all seems to have run ok:

tail /var/log/samba/log.smbd 

Finally, testparm and press Enter should show you the computed parameters in the current Samba session, just scroll up until you see the global options and these parameters should be there. Here’s my output:

# Global parameters
[global]
	realm = *
	workgroup = WORKGROUP
	printcap name = cups
	server min protocol = SMB2
	passdb backend = smbpasswd
	security = USER
	winbind enum groups = Yes
	winbind enum users = Yes
	fruit:resource = file
	fruit:metadata = stream
	fruit:locking = none
	fruit:encoding = native
	fruit:aapl = yes
	idmap config * : backend = syno
	include = /var/tmp/nginx/smb.netbios.aliases.conf
	vfs objects = fruit

All done! If your shares are still visible on your Mac, disconnect them and mount them again. Test out and see if this made any difference!

Additional notes:

  • I’ll update this if anything new comes up (namely a DSM upgrade), but do leave a comment below if you have any comments/insight.
  • I had custom icons for my file shares setup (via .VolumeIcon.icns files), and a Finder is now ignoring those. It’s probably something related to one of the vfs fruit options.
  • I’ve seen recommendations online about loading vfs catia and streams_xattr modules as well but I’m not these helped in any way when I tested..
  • Available modules are located in /usr/lib/samba/vfs/
  • The vfs_streams_xattr module is not available but streams_xattr is, I assumed it’s the same.
  • There are also what looks like proprietary Synology modules, prefixed by synovfs_...

Make it Persistent

After Reboots

This can be done via DSM UI, which I recommend, instead of messing around even more with SSH.
Note: I still need to check if this runs on reboots.

#!/bin/sh

# backup default smb.conf
cp /var/tmp/nginx/smb.netbios.aliases.conf /usr/local/etc/rc.d/smb.netbios.aliases.conf

# copy backup config file
cp /usr/local/etc/rc.d/smb.netbios.aliases.conf /var/tmp/nginx/smb.netbios.aliases.conf 

# restart samba
/usr/syno/sbin/synoservicecfg --restart samba

After DSM Upgrades

To be verified, but the solution above (for reboots) should also work for DSM upgrades.


Other Possible Performance Improvements:

Adjust SMB browsing behavior

In this link you’ll find several suggestions made by Apple that might improve your SMB browsing experience as well:

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

Turn off packet signing for SMB 2 and SMB 3 connections

One other possible culprit of slow performing SMB file shares may be SMB packet signing to be enabled on your Mac. To disable this, you’ll need to edit (or create the file if it’s not there), as described by this Apple article:

https://support.apple.com/en-us/HT205926

Advertisement