Configure Samba to work better with Apple devices

Thanks to user @mrcnee93 who posted about their experience with iOS devices using Samba on the Rockstor device (Github Issue Link)

While using recent MacOS devices to access and interact with Samba shares, read/write transactions were not posing a problem. However, when using an iOS device (iPad/iPhone), write attempts, i.e., copying or moving a file from the iOS device to a Rockstor share using Samba would fail with an error message like

` filename too long or special characters …’, and then creating a 0 byte file on the Rockstor target.

Note: this is relevant for iOS devices with versions at least up to 16.6. Newer versions of iOS might require less or different changes.

Samba contains a few vfs_objects that were specifically created to enable and improve the interaction between Apple devices in general.

Rockstor is already taking advantage of it, when a Samba share is created and the Time Machine option is activated.

In the /etc/samba/smb.conf file, the following Samba settings are added:

vfs objects = catia fruit streams_xattr
fruit:timemachine = yes
fruit:metadata = stream
fruit:veto_appledouble = no
fruit:posix_rename = no
fruit:wipe_intentionally_left_blank_rfork = yes
fruit:delete_empty_adfiles = yes
fruit:encoding = private
fruit:locking = none
fruit:resource = file

vfs objects = catia fruit streams_xattr introduces three objects:

  • catia, this object provides a safeguard for non-translatable characters, which the catia filetype (CAD files) could often contain.
  • fruit, this object provides the framework for dealing with Apple devices
  • streams_xattr, this object supports the support of Apple extensions.

fruit:timemachine = yes is typically maintained at the share level, which a user will designate to be the backup target when using timemachine.

The other settings are dealing with locking, metadata, file cleanup, etc. aspects. Of note with these settings is, that a non-Apple device (e.g., windows client) could have issues reading data on that share, but, since this is designated to be a Time Machine connection, is less of a concern.

To improve the overall experience for all Rockstor shares, one can maintain similar settings at the global level, which can be found in the configuration of the Samba service in the WebUI:

Since the entries in the global configuration can be overwritten using configurations at the share level, similar entries put there will not impact on how Rockstor currently treats a Time Machine designated share.

The suggested global settings are based on this Wiki entry here:

https://wiki.samba.org/index.php/Configure_Samba_to_Work_Better_with_Mac_OS_X

While this discusses the settings in the context of Mac OS X, I found that it seems to apply specifically to the above-mentioned iOS device issues.

Adding these entries at the global level worked for my setup:

min protocol = SMB2
ea support = yes
vfs objects = catia fruit streams_xattr
fruit:delete_empty_adfiles = yes
fruit:metadata = stream
fruit:model = MacSamba
fruit:nfs_aces = no
fruit:posix_rename = yes
fruit:veto_appledouble = no
fruit:wipe_intentionally_left_blank_rfork = yes

I have not tested every permutation of file types/source OS to upload/read with different clients, but the small selection I have used seemed to work fine between iOS, Windows, and Linux clients.

I am interested in hearing whether others have solved the same or similar issues differently.

4 Likes