Resolving MAC OS/X folder frequent refreshes on an SMB file share
Recently working with a group of MAC users, I came across a very annoying issue.
The user complains. How can I get rid of this annoying Folder Refreshes about every 30-60 seconds?
The user explains. I am mounting a file share on my MAC, the file share has many files / folders(100k+), last, the file share is mounted using the SMB protocol.
In Finder, going to my folder destination, about every 30-60 seconds, the Finder folder structure refreshes, I then find my self back in the top root destination folder (extremely annoying).
The user also claims, we did not have this issue in older versions of the OS (he doesn’t know the exact version the issue started)
After researching the issue, the fowling solution fixed our issue.
Create a file /etc/nsmb.conf – global option(if not exists) or it can be applied on a per user login, create a file/folder ~/Library/Preferences/nsmb.conf.
Then, add these entry’s.
Note: The solution (and issue) was tested on MAC OS X El Capitan (version 10.11.5+).
In some of the earlier versions, the protocol used for CIFS/SMB was 1.x, causing MAC/OS to behave different on refreshes (in fact you can still used that as a workaround by doing somthing like thiscifs://server@share/dir1).
To note, since there is no refresh button in Finder, the MAC OS has to be smart enough to auto refresh whenever there is a file/directory change, in fact, there where many user’s complaining in older versions of MAC OS/X files/folder not getting refreshed (+workarounds for that).
In latter releases (like ours) 10.11.5+ using SMB version 3.0, plus having notify_off=no(default), can cause constant folder structure refreshes, as a test changing to smb_neg=smb1_only will address the issue. we are forcing v3 as its many times faster then older releases.
Options available for nsmb.conf
Options available for /etc/nsmb.conf taken from the man page.
Note: Apply changes with caution as it might have an adverse effect.
The SMB library uses the following information for section names:
Possible keywords may include:
Keyword Section Default Comment
A B C Values
addr - + - DNS name or IP address of
nbtimeout + + - 1s Timeout for resolving a NetBIOS
minauth + + - NTLMv2 Minimum authentication level
port445 + + - normal How to use SMB TCP/UDP ports
streams + + + yes Use NTFS Streams if server
soft + + + Make the mount soft
notify_off + + + no Turn off using notifications
kloglevel + - - 0 Turn on smb kernel logging
smb_neg + - - normal How to negotiate SMB 1/2/3
signing_required + - - yes Turn off smb client signing
signing_req_vers + - - 6 Bitmap of SMB Versions that
have signing required
validate_neg_off + - - no Turn off using validate
max_resp_timeout + + - 30s Max time to wait for any
response from server
read_async_cnt + + - 4 Max async number of reads
write_async_cnt + + - 4 Max async number of writes
dir_cache_async_cnt + + - 10 Max async queries to fill dir
dir_cache_max_cnt + + - 2048 Max entries to cache for a dir
dir_cache_max + + - 60s Max time to cache for a dir
dir_cache_min + + - 30s Min time to cache for a dir
Did you also run in to this issue? do you have a better solution?, Please let me know in the comments below.