macbook访问windows 共享磁盘by samba

本文介绍如何解决Mac OS下访问Windows SMB共享时速度缓慢的问题。通过禁用.DS_Store文件写入、确保NetBIOS over TCP/IP启用及调整SMB配置,可显著提升传输速率。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

  • windows上磁盘大,最好能直接访问
  • macbook 磁盘小,通过samba访问windows挺慢的,不知道啥原因
  • 有人说是nfs问题,实际上是samba网络传输的,应该提高samba的速度

windows 共享

  • 应该是samba协议吧

macbook的配置

  • tcp 的ack delay 改了 3改为0了,不知道有啥影响???
sudo sysctl -w net.inet.tcp.delayed_ack=0

Password:
net.inet.tcp.delayed_ack: 3 -> 0
  • 不写 DS_STORE文件了
defaults write com.apple.desktopservices DSDontWriteNetworkStores true

-参考

On MacOS 10.13.x I was getting terrible network transfer speeds from my Mac laptop to the network share being served by another mac. We were only getting 10MB/s which was not even enough to stream videos at 720p but yet on the iMac this external RAID array was attached to we were getting 200MB/s+ and could stream 2160p30 (4k) videos no problem.

Server serving the network share:
MacOS High Sierra (10.13.6), External 24TB RAID array in RAID 10.

Client access the network share (SLOW):
MacOS High Sierra 10.13.4 (also happens in 10.13.5)

The fix:

Make the change temporary (without rebooting):

Open a terminal
sudo sysctl -w net.inet.tcp.delayed_ack=0
1
sudo sysctl -w net.inet.tcp.delayed_ack=0
Close and re-open Finder and see if the problem goes away. Also close and re-open your throughput testing app (in my case BlackMagic Disk Speed Test app) before testing again (required!). This setting for me was set to 3, changing it to 0 fixed it and then changing back to 3 caused it to drop back down to 10MB/s, confirming the resolution.
To make the change permanent (requires reboot):

Create/edit the file /etc/sysctl.conf
sudo vim /etc/sysctl.conf
1
sudo vim /etc/sysctl.conf
Add this line to the configuration file:
net.inet.tcp.delayed_ack=0
1
net.inet.tcp.delayed_ack=0
Save and close file (type “:wq” without quotes, then hit enter)
reboot computer
Open finder and your problem should be resolved.
If it is not, try the guide that shows how to enable vfs_fruit module for Samba, I believe this is only useful if the server hosting the share is NOT a Mac as it enables better Mac compatibility for Samba. You can also try installing Samba instead of the MacOS implementation of SMB.
The Mac laptop that was struggling I had tried multiple known fixes before this:

Disabling SMB Signing (smb_signing) and it did show it as disabled in the terminal but had no impact for me. I disabled on both server and client and reconnected the share and restarted all services.
Changing connection from SMB to AFP, reconnected share, no impact
The final change, disabling Delayed TCP ack, fixed it.

windows要配置

  • windows的ipv4的高级里面选择 打开netbios选项
  • windows的samba配置通过powershell 管理员身份更改配置
  • 我还关闭了windows的防火墙 (可以不用关闭的?
  • https://community.spiceworks.com/how_to/85131-fix-slow-access-of-windows-smb-share-from-mac-os

It's a common complaint that in recent versions of Mac OS 10.x, browsing Windows-hosted SMB shares is incredibly slow. Not every solution works, but here are 3 simple fixes that completely solved the issue for me (Using Windows Server 2012 & 2012R2 with Mac OS X 10.9 & 10.10).

3 Steps total
Step 1: Disable writing .DS_Store files to network shares
On the Mac, open up Terminal and enter the following command:

defaults write com.apple.desktopservices DSDontWriteNetworkStores true

Step 2: Make sure NetBIOS over TCP/IP is enabled on the file server's network adapter
Adapter Properties -> IPv4 properties -> Advanced -> WINS tab -> Enable NetBIOS over TCP/IP

Make sure this setting is enabled.

Step 3: Use Powershell to edit the server's SMB configuration.
On the Windows server, open Powershell as an administrator and run:

get-smbserverconfiguration

Look for the values for smb2creditsmin and smb2creditsmax. On my server, the defaults were 128 and 2048 respectively. To change these settings, run

set-smbserverconfiguration -smb2creditsmin 512 -smb2creditsmax 8192

and respond Y to the confirmation prompt.

Following these three steps instantly fixed the issue for me and others, and my Macs are now browsing the file shares just as fast as their Windows counterparts.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

等风来不如迎风去

你的鼓励是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值