These Samba config options have been performing fantastically well for me. It took quite a bit of research to finalise the config you see below, so figured it was worth sharing.
My setup is a Debian server with BTRFS storage, and windows clients. Requirements are:
- Good performance, especially with lots of tiny files, complex directory trees, random writes within files, etc.
- Preservation of all reasonable windows file attributes, such as:
- Creation date
- DOS attributes
- Anything else necessary for standard desktop workload such as steam game library, documents/pictures/etc folders, git, etc.
- Continuing the previous point: It should feel like the server is running Windows - no weird surprises.
- No preservation of anything that allows Windows to behave in unpredictable Windows-like ways - specifically no ACL support.
- Sane Linux filesystem permissions
- When I browse through my windows files, they should look like a Linux home directory, no weird permissions etc.
- Everything Windows-specific should be abstracted away into xattrs.
- Everything should be executable on Windows, but not executable on Linux, as that is the cleanest representation of the platform difference IMO.
- Backup-able with standard Linux tools like tar and borg (xattrs must be enabled!)
- Correct behaviour of BTRFS features such as compression.
Without further ado:
[global] socket options = IPTOS_LOWDELAY TCP_NODELAY use sendfile = yes min protocol = SMB2 vfs objects = btrfs create mask = 644 acl allow execute always = yes store dos attributes = yes map readonly = no map archive = no ea support = no nt acl support = no
Options I specifically avoid are:
SO_RCVBUF=131072 SO_SNDBUF=131072- specifically recommended to avoid by newer Samba releases.
case sensitive = yes- breaks too many things, performance improvement is barely noticeable.
strict allocate = yes- breaks BTRFS compression.
And one final note, I noticed a substantial performance improvement in my use case of SMB when upgrading from Debian 9 to Debian 10, so if you are on a lower Samba version than 4.9, consider upgrading!
2022 Update: Removed various options that seem spurious or even wrong after referring to latest documentation. The defaults are better than they used to be.
Leave a Reply