Tuning SMB

Making a Samba server "very fast" involves moving from standard compatibility settings to performance-focused ones.
Important Warning: "Fast" is relative to your hardware. The settings below assume you have decent hardware (Gigabit or 10-Gigabit Ethernet and modern hard drives or SSDs).
Here is the step-by-step tuning guide, ordered from "Safe & Effective" to "Advanced."
Step 1: The "Turbo" Config (Safe & Effective)
Modern Samba relies on Asynchronous I/O (AIO) and Multichannel support.
Open your config:
Bash
sudo nano /etc/samba/smb.confAdd the following lines inside the
[global]section. (Remove any conflicting lines if you see them).Ini, TOML
[global] # ... existing settings ... # 1. Enable Asynchronous I/O (Crucial for speed) # This forces Samba to handle reads/writes without blocking the CPU. aio read size = 1 aio write size = 1 # 2. Network Optimization # TCP_NODELAY sends data immediately without waiting for full packets. # Note: Do NOT set SO_RCVBUF or SO_SNDBUF manually anymore; Linux auto-tunes this better than you can. socket options = TCP_NODELAY IPTOS_LOWDELAY # 3. Enable SMB Multichannel (The "Turbo Button") # Allows a single client to use multiple network connections simultaneously. # Tremendously increases throughput if you have dual LAN ports or fast WiFi + LAN. server multi channel support = yes # 4. Apple/Mac Optimizations (If you use Macs) # Makes browsing folders on macOS much snappier. vfs objects = fruit streams_xattr fruit:metadata = stream fruit:model = MacSamba fruit:posix_rename = yes fruit:veto_appledouble = no fruit:nfs_aces = no fruit:wipe_intentionally_left_blank_rfork = yes fruit:delete_empty_adfiles = yes # 5. General Speed Tweaks use sendfile = yes min receivefile size = 16384 getwd cache = yesSave and restart Samba:
Bash
sudo systemctl restart smbd
Step 2: Enable "Jumbo Frames" (The Network Layer)
If you are transferring large files (movies, backups) over a wired connection, standard network packets are too small (1500 bytes). Increasing this to 9000 bytes (Jumbo Frames) significantly reduces CPU load and increases speed.
Prerequisite: Your Router/Switch AND your PC must also support/be set to Jumbo Frames (MTU 9000). If one device doesn't support it, the connection will break.
Check current MTU:
Bash
ip link show # Look for "mtu 1500"Set MTU to 9000 (Temporary Test):
Bash
sudo ip link set dev eth0 mtu 9000 # (Replace 'eth0' with your actual interface name, e.g., enp3s0)Test the transfer. If it works and is faster, make it permanent in your Netplan or NetworkManager settings.
Step 3: Hardware Reality Check
If you apply all the settings above and it's still slow, the bottleneck is physical.
HDD vs. SSD: If you are using mechanical hard drives, you are capped at roughly 100MB/s - 150MB/s. No software tuning can fix this. You need an SSD or a RAID array.
WiFi vs. Ethernet: WiFi (even WiFi 6) is terrible for sustained file transfer protocols like SMB due to latency. Always test speed over a CAT6 cable.
CPU Power: Samba is single-threaded per user connection (unless Multichannel is active). If you have a very weak CPU (like an old Raspberry Pi), it might max out at 30-40MB/s regardless of your disk speed.



