SOLVED: Tweaking Samba/SMB2 for Mac & Androids

#1

Trying to tweak the Samba settings on MyCloud Gen.1 running latest 04.05.xx firmware on network of Macs & Androids only.

Problem 1 - Both testparm and /var/log/samba/log.smbd throw off errors for parameters set in /etc/samba/tm_config.conf which are under the [TimeMachineBackup] section, specifically durable handles, kernel oplocks (a Global parameter…), kernel share modes, max share size & drive cache flush.

Solution 1 - Have added fruit:time machine = yes which forces these setting by share:

durable handles = yes
kernel oplocks = no
kernel share modes = no
posix locking = no

and commented out the correspending parameters.

Problem 2 - Although the MyCloud version of smbd (4.3.11) has vfs_catia, vfs_fruit & vfs_streams_xattr built-in (smbd -b), Wireshark shows that it ignores the GetInfo Request FILE_INFO/SMB2_FILE_ALL_INFO for the AAPL extensions provided by vfs_fruit:

From the Mac…

AAPL Create Context request
    Command code: Server query (1)
    Reserved: 0x00000000
    Query bitmask: 0x0000000000000007, Server capabilities, Volume capabilities, Model information
        .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... ...1 = Server capabilities: True
        .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... ..1. = Volume capabilities: True
        .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... .1.. = Model information: True
    Client/Server capabilities: 0x000000000000000f, Supports READDIRATTR, Supports macOS copyfile, UNIX-based, Supports NFS ACE
        .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... ...1 = Supports READDIRATTR: True
        .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... ..1. = Supports macOS copyfile: True
        .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... .1.. = UNIX-based: True
        .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... 1... = Supports NFS ACE: True

Solution 2 - I believe the AAPL extensions require “ea support = yes” in the [Global] if I want Mac support across the NAS, which I do. Is it safe to do this on MyCloud where I already have files stored?

New Mac OSX related smb.conf:

[Global]
#
# PREREQUISITES TO FUNCTION WITH OSX
#
  min protocol = SMB2
  ea support = yes
#
# NOT NEEDED WITH OSX/LINUX
#
  disable netbios = yes
  dns proxy = no
  smb ports = 445
  name resolve order = host bcast
#
# GENERAL COMPATABILITY WITH OSX SMB
# adds alternate data streams (ADS) support
#
  vfs objects = catia fruit streams_xattr
#
# STORAGE OF OSX METATDATA & RESOURCE FORK 
# in Netatalk compat xattr & ._ AppleDouble File
#
  fruit:metadata = netatalk
  fruit:resource = file
#
# FILE LOCKING
# no cross protocol locking
#
  fruit:locking = none
#
# MAP NTFS ILLEGAL CHARS TO UNICODE
#
  fruit:encoding = private
#
# SMB2+ AAPL EXTENSIONS
# file metadata - Unix mode, FinderInfo, resource fork size, permissions
#
  fruit:aapl = yes
  readdir_attr:aapl_rsize = yes
  readdir_attr:aapl_finder_info = yes
  readdir_attr:aapl_max_access = yes
  fruit:nfs_aces = yes
#
# OSX COPYFILE
#
  fruit:copyfile= yes
#
# PERFORMANCE TWEAKS
# note - error with smb2 leases
#
  smb2 leases = yes 
  kernel oplocks = no
  use sendfile = yes
#
# FILE CLEANUP
#
  delete veto files = true
  unix extensions = yes
  fruit:posix_rename = yes
#
# PARAMETERS IN SAMBA VERSION > 4.3.11?
# testparm does not check fruit parameters
#
  fruit:model = MacSamba
  fruit:veto_appledouble = yes
  fruit:zero_file_id = yes
  fruit:wipe_intentionally_left_blank_rfork = yes
#
## END OF ADDED CONFIGS
#

Benefits:

  1. NAS now responds with enhanced capabilities:
Data: AAPL Create Context response
    AAPL Create Context response
        Command code: Server query (1)
        Reserved: 0x00000000
        Query bitmask: 0x0000000000000007, Server capabilities, Volume capabilities, Model information
        Client/Server capabilities: 0x000000000000000f, Supports READDIRATTR, Supports macOS copyfile, UNIX-based, Supports NFS ACE
            .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... ...1 = Supports READDIRATTR: True
            .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... ..1. = Supports macOS copyfile: True
            .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... .1.. = UNIX-based: True
            .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... 1... = Supports NFS ACE: True
        Volume capabilities: 0x0000000000000002, Case sensitive
            .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... ...0 = Supports Resolve ID: False
            .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... ..1. = Case sensitive: True
            .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... .0.. = Supports full sync: False
        Model string: Samba
  1. Requests (from the Mac) and responses (from the NAS) are chained (i.e. multiple elements in one SMB packet) resulting in fewer SMB packets and quicker response. Depending on size of the directory, Finder loads in less than half the time & half the SMB2 packets.
Create Response File; GetInfo Response; Close Response
How to connect MyCloud 2TB to Mac for faster transfer