[Samba] Missing files (80% invisible) in a large folder

Michael Gleaves michaelgleaves at privacymail.sh
Thu Sep 22 21:37:30 UTC 2022


I am using Samba to expose a share to my network on which I have a 
folder with just over 10k photos, judging by the host system. But I've 
just noticed that on my Windows client, only ~3000 of those are visible 
while on all my linux machines (using a cifs mount) even fewer (1793) of 
these photos show up. The files that are visible are always the same 
ones and don't change when remounting. By using `noserverino` in the 
mount-options on my linux machine I get around 100 more files (1867).

This seems to be the only affected folder, but it is the only one that 
contains so many files. The files have no special attributes as far as I 
can tell. I already tried using `echo 1 > /proc/fs/cifs/traceSMB` on the 
client, but there were no (readable) information different from what I 
could observe through ls. I tried both protocol versions 2.1 and 3.0 but 
haven't seen any difference.

The server that runs samba is a virtual machine running gentoo, and was 
recently updated. I cannot tell whether the problem is actually new or 
whether I just never noticed. Everything is also 100% reproducible right 
now, so I can test patches if necessary.

Below I have listed the exact software versions and config files 
involved. Please let me know if you have any idea what the culprit could be.

Best regards,
Michael Gleaves


The exact software versions involved are:

- linux kernel 5.18.14-gentoo-dist (cannot update to 5.19 due to missing 
ZFS support)
- samba 4.16.4
- libvirt 8.7.0
- qemu 7.0.0
- ZFS 2.1.5

My logical setup (in case it makes any difference):

Physical Host (gentoo VM host)
├─ ZFS dataset mounted on /var/datasets/samba, exposed to VM via virtfs
└─ Virtual Machine (hosted with libvirt and qemu, also runs gentoo)
    ├─ mount (virtfs, 9p): /var/datasets/samba passthrough to /data
    └─ Runs samba

My /etc/samba/smb.conf:

server string = My Samba Share
server role = standalone

# auth and security
security = user
# server min protocol = SMB3_11
# Needed for IOS and Android compatibility :(
server min protocol = SMB2_10
client signing = required
client smb encrypt = required
client smb3 encryption algorithms = AES-256-GCM
# server smb encrypt = required (not working with android clients)
server signing = mandatory
passdb backend = tdbsam
# always reject login requests with invalid password, never map to guest.
map to guest = Never
guest account = nobody

# network config
interfaces = enp0
smb ports = 445
bind interfaces only = yes
hosts deny =
hosts allow =

# logging
log level = 0 auth:2 passdb:2
log file = /dev/null
max log size = 0
logging = systemd

# disable broadcasting by disabling netbios
disable netbios = yes
dns proxy = no

# disable printing
load printers = no
printcap name = /dev/null

# defaults for shares
public = no
writable = yes
create mask = 0660
directory mask = 0770
force create mode = 0660
force directory mode = 0770
acl allow execute always = yes

# map illegal windows characters to alternatives
vfs objects = catia
catia:mappings = 

path = /data/shares/storage
valid users = myuser

More information about the samba mailing list