Reference Discussion Thread: SMB (Samba) Server-Side Copy Support: Enabled for Mac OS? - #3 by SinisterPisces
Hello. I’m using TrueNAS on a network where I’ve got 3 production Macs accessing various SMB shares.
I want to make sure that these Macs are using SAMBA’s Server Side Copy feature. See: Server-Side Copy - SambaWiki
Samba 4.1.0 was the first release to ship with support for server-side copy operations via the SMB2 FSCTL_SRV_COPYCHUNK request. Clients making use of server-side copy support, such as Windows Server 2012 and Windows 8, can experience considerable performance improvements for file copy operations, as file data need not traverse the network. This feature is enabled by default on the smbd file server.
Note - not enabled for OS X (Macs) unless server Samba includes vfs_fruit module and fruit:copyfile = yes in smb.conf.
Samba 4.7.0 introduced support for FSCTL_DUPLICATE_EXTENTS_TO_FILE, which similarly allows for offloaded clone operations.
Currently, per @swc-phil in the referenced thread above, it is possible to specify the needed SMB parameter via the ‘Additional Parameters String’ under the advanced options of the smb share."
Currently, the fruit:copyfile = yes
is not present in 24.10 Dragonfish’s smb4.conf
file, and can only be set by adding an optional flag for each share.
Problem/Justification
(What is the problem you are trying to solve with this feature/improvement or why should it be considered?)
As noted above, the fruit:copyfile = yes
is not present in 24.10 Dragonfish’s smb4.conf
file, and can only be set by adding an optional flag for each share. (I’m not sure of its status in 25.04.0.)
Having to manage this setting per-share to enable server-side copy on Mac clients is doable, but adds an extra step to share creation. It’s not at all obvious that this needs to be done for Mac clients when adding shares, and since it has to be done for every share, it is potentially error-prone (e.g., it’s easier to forget to turn on for each share than it would be to enable a global option once).
Additionally, right now, this feature is not discoverable. I didn’t even realize it was an option I could adjust to improve performance when working with files the Mac I use to adminster the server until I randomly stumbled on a thread here that made me realize this feature existed. A quick trip to the SAMBA wiki confirmed my suspicion that it wasn’t enabled by default, because when it comes to Mac OS’s native implementation, everything about SMB has to be just a little bit more complicated.
I’m not sure how difficult this would be to implement, or whether it has any negative implications. So, I propose two ways to implement it.
- Change Default
SMB4.conf
File. Assuming no negative performance or stability implications or other issues that make it a bad idea, enabling this by default will ensure that–at least on this point–Windows and Mac users will each get full advantage of this feature out of the box. - Provide a checkbox to enable this at the SMB service-level in the advanced options. The Advanced Options already contain a couple of Mac-specific options. This could be added alongside them. See the attached screenshot for reference.
Impact
(How is this feature going to impact all TrueNAS users? What are the benefits and advantages? Are there disadvantages?)
Adjusting the default or even adding a more visible Advanced Setting will improve the SMB experience for every Mac user using SMB to manage data across more than one dataset/SMB share.
When moving files around between two datasets with shares around, it is much easier for users (especially less technical users or those who don’t have permissions sufficient to access the TrueNAS CLI), to just copy the files from one share to another in the Mac or Windows file manager.
This kind of workflow is quite frequent, and should be equally performant on Windows and Mac machines, without requiring an SMB flag be set manually for every share.
User Story
(Please give a short description on how you envision some user taking advantage of this feature, what are the steps a user will follow to accomplish it)
Assuming the default SMB4.conf
has been changed, or the user enables Server-Side Copy in the advanced options for the SMB service (depending on how this feature is implemented), users managing TrueNAS data across datasets via mounted SMB shares will immediately see a benefit during file transfers.
SMB is already known to be potentially slow, especially when copying/moving a lot of small files. This is a common worflow for users who aren’t working with large media, for example. Enabling this feature by default–or making it easy to enable–will in many cases provide better performance (and better perceived performance) during a workflow they’re already using.