KB450114 – Mac OSX Samba Optimization

Last modified: April 5, 2019
You are here:
Estimated reading time: 1 min

Please refer to this article for an explanation as to why Samba and Finder are slow.

The following performance tunes have been tested with OSX High Sierra. Previous versions should benefit as well but trial and error are recommended.

SMB Signing

Since the release of OS X 10.11.5, Apple’s SMB Signing has been enabled by default.

SMB Signing digitally signs at the packet level of the SMB communication. This enables the receiver of the packets to confirm the point of origin and it’s authenticity. This security mechanism helps avoid issues like tampering and “man in the middle” attacks – as long as you’re on a secure network.  However, this causes poor performance –  to disable this option see below.

  1. On each Mac OSX client:
    • echo “[default]” » /etc/nsmb.conf
    • echo “[default]” » /etc/nsmb.conf
  2. Reboot client

To verify it worked run:

  • smbutil statshares -a
    • If “SIGNING_ON TRUE” is not present, then signing is disabled

VFS FRUIT

Use the vfs fruit object to enhance OS X performance. See vfs_fruit man page for reference.

Fruit in combination with streams_xattr significantly enhances performance/compatibility of samba network shares and OSX. This should always be used whenever the environment contains OSX clients. This is safe to use with mixed environment of windows and OSX clients.

  • Add to smb.conf [SHARE] definitions that will be used by osx clients:
    • vfs objects = fruit streams_xattr
    • ea support = yes
  • If using glusterfs, fruit is stackable just make sure glusterfs is last
    • vfs objects = fruit streams_xattr glusterfs

Veto AppleDouble Files

Veto the creation of ._ and .DS_Store files on the network fileshare to increase directory performance.

NOTE that certain OSX applications require these files to function correctly.
Test workflow with these disabled to verify.

  • Add to smb.conf [SHARE] definitions that will be used by osx clients
    • veto files = /._*/.DS_Store/
    • delete veto files = yes
  • Delete existing ._ and .DS_Store files on the share
    • cd /FILE/SHARE ; find \( -name “.DS_Store” -or -name “.Trashes” -or -name “._*” -or -name “.TemporaryItems” \) -delete
  • On each OSX client, disable the creation of .DS_Store and ._ on network shares
    • defaults write com.apple.desktopservices DSDontWriteNetworkStores true

—-

Example of smb.conf for a glusterfs volume.

Note: Bolded text are options added for enhanced OS X compatibility.

[fileshare]
comment = For samba share of volume fileshare
vfs objects = fruit streams_xattr glusterfs
glusterfs:volume = fileshare
glusterfs:logfile = /var/log/samba/glusterfs-fileshare.%M.log
glusterfs:loglevel = 7
path = /
read only = no
guest ok = yes
kernel share modes = No
valid users = @45D,root
ea support = yes
veto files = /._*/.DS_Store/
delete veto files = yes
Was this article helpful?
Dislike 0
Views: 765