Disable local SMB directory enumeration caching

You can disable local caching so that you always see a list of current files and folders on an SMB share. On busy or large file shares, items might disappear from Finder while the local cache rebuilds in macOS 10.11 or 10.12.

When you use an SMB 2 or SMB 3 connection, local caching is enabled by default. You might want to turn off local caching if:

  • Content on the server changes frequently.
  • Finder sometimes shows only a partial list of the contents of a share or folder for a few seconds.

Disable local SMB caching on a macOS client

First check to see if your macOS computer has an /etc/nsmb.conf file.

If your macOS computer has an /etc/nsmb.conf file

  1. Open the /etc/nsmb.conf file as root.
  2. Set the dir_cache_max_cnt value to “0” by adding the following lines:
    [default]
    dir_cache_max_cnt=0

  3. Save the /etc/nsmb.conf file.
  4. Disconnect any mounted SMB shares and then reconnect them so that the changes take effect.

If your macOS computer doesn’t have an /etc/nsmb.conf file

  1. Open Terminal.
  2. Use these commands to create an /etc/nsmb.conf file that has a dir_cache_max_cnt value that’s set to “0”: 
    sudo -s
    echo "[default]" >> /etc/nsmb.conf
    echo "dir_cache_max_cnt=0" >> /etc/nsmb.conf
    exit
  3. Disconnect any mounted SMB shares and then reconnect them so that the changes take effect.
發佈日期: