Finder thinks item exists after it’s already been deleted (Samba)

findersmb

First, I copied foo.7z to my SMB share (zfs zpool, Ubuntu 18.04 LTS, Samba 4.7.6) through finder. Over SSH, I moved it elsewhere on the server. I tried copying a different foo.7z again to the same location as the old one, but finder says:

"The operation can’t be completed because an item with the name “foo.7z” already exists."

This is not true, as the file isn't there anymore after I moved it.

Here's my smb.conf on the ubuntu server:

[global]
mangled names = no
dos charset = CP850
access based share enum = yes
unix extensions = no
fruit:aapl = yes
fruit:model = MacPro
unix charset = UTF-8
fruit:resource = xattr
workgroup = WORKGROUP
server string = %h server (Samba, Ubuntu)
dns proxy = no
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d
server role = standalone server
passdb backend = tdbsam
obey pam restrictions = yes
unix password sync = yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
pam password change = yes
map to guest = bad user
usershare allow guests = yes

[SMB Share]
 comment = SMB Share
 path = /tank
 browseable = yes
 read only = no
 guest ok = no
 ea support = yes
 vfs objects = catia fruit streams_xattr
 map archive = no
 spotlight = yes
 readdir_attr:aapl_rsize = yes
 readdir_attr:aapl_finder_info = yes
 readdir_attr:aapl_max_access = yes

Using High Sierra 10.13.6.

Best Answer

Finder caches file/folder metadata from SMB shares. Try if disabling the directory caching helps according to the last paragraph in:

Disable directory caching

Your Mac caches file and folder metadata temporarily in local memory. This improves browsing speeds, especially on high-latency networks. Systems with more memory installed can cache more file information.

If you'd like to disable directory caching so that macOS re-downloads the full contents of the folders and metadata every time you browse an SMB share, you can create or edit /etc/nsmb.conf. See the nsmb.conf man page for more information on how to edit this file.

If your system doesn't already have an /etc/nsmb.conf file, use the following Terminal commands. Note that you must be logged in as an administrator with sudoer privileges to set this file:

echo "[default]" | sudo tee -a /etc/nsmb.conf

echo "dir_cache_off=yes" | sudo tee -a /etc/nsmb.conf

Unmount/remount SMB shares afterwards.