Post

Diagnosing and Optimizing SMB Performance Between Two M1 Macs

Diagnosing and Optimizing SMB Performance Between Two M1 Macs

1. Diagnosing the Problem

  1. Check Network Speed

    • Use iperf3 to measure network throughput between the two Macs.

      # On Mac B (SMB Server)
      iperf3 -s
      
      # On Mac A (Client)
      iperf3 -c <Mac B's IP>
    • If the speed is close to 1Gbps, the network is performing as expected.

    • If it’s significantly lower (e.g., below 500 Mbps), there may be a bottleneck in the network hardware or cabling.

  2. Check Latency with ping

    • Use ping to measure round-trip time between Mac A and Mac B.

      ping -c 10 <Mac B's IP>
    • A response time below 1ms is expected.

    • If latency is higher, check for network congestion or interference.

  3. Test File Transfer Speed

    • Copy a large file using rsync to measure SMB performance.

      rsync --progress /Volumes/SharedDrive/testfile.bin ~/Desktop/
    • A well-performing SMB connection on a 1Gb network should achieve speeds close to 110 MB/s.

2. Diagnosing SMB-Specific Issues

SMB Version

Check which SMB version is being used.

smbutil statshares -a
  • If the SMB version is 2.1, it may not be negotiating SMB 3 properly.

Forcing SMB 3
  • Modify /etc/nsmb.conf to enforce SMB 3.

    [default]
    protocol_vers_map=6
  • Restart SMB services:

    sudo launchctl stop com.apple.smbd
    sudo launchctl start com.apple.smbd

3. Optimizing macOS for SMB

Finder Metadata Indexing
  • Finder generates thumbnails and previews, which can slow down SMB access.

  • Disable animations and metadata caching:

    defaults write com.apple.finder DisableAllAnimations -bool true
    killall Finder
Opportunistic Locking
  • Disabling OpLocks can improve performance. Add to /etc/nsmb.conf:

    [default]
    oplocks=no
  • Restart SMB services:

    sudo launchctl stop com.apple.smbd
    sudo launchctl start com.apple.smbd
Spotlight Indexing
  • Prevent Spotlight from indexing SMB shares:

    sudo mdutil -i off /Volumes/SharedDrive
  • Permanently exclude the SMB share from indexing:

    echo "/Volumes/SharedDrive" >> ~/.metadata_never_index
Disabling SMB Signing

SMB signing adds security but reduces performance. It is enabled by default on macOS, which can impact file transfer speeds [1].

  1. Check if SMB signing is enabled:

    sysctl -a | grep net.smb.fs.kern.signed
    • If it returns 1, signing is enabled.

  2. Disable SMB signing:

    [default]
    signing_required=no
  3. Restart SMB services:

    sudo launchctl stop com.apple.smbd
    sudo launchctl start com.apple.smbd

4. Testing Performance After Optimization

  • Re-run iperf3 to verify network speeds.

  • Use cp or rsync to test file transfer speeds.

  • If performance is still slow, consider using NFS instead of SMB for macOS-to-macOS file sharing [2].

5. Expected Improvements

  • Enabling SMB 3: 10–20% improvement in speed.

  • Disabling SMB signing: Up to 2× faster transfers.

  • Disabling Finder previews: Faster browsing of network shares.

  • Preventing Spotlight indexing: No lag when accessing files.

  • Using rsync instead of Finder: More consistent transfer speeds.

After applying these optimizations, SMB performance should be significantly improved, reducing latency and maximizing transfer speeds across the 1Gb network.

This post is licensed under CC BY 4.0 by the author.

Trending Tags