Samba too slow after some time

Hi all, after some time (days of system uptime), network transfer through Samba became too slow (up to 1 Mbit/s). After restart, everything is back Ok. Any ideas whats wrong? Or which info should I provide to analyse it (step-by-step please, as I am Linux noob).

Thanks in advance

Some local reading … it is in czech, but linked urls are pretty much handy …

To help you more, we need some log dumps, config files content to read.

Hi Maxmilian, thanks much, czech is no problem, I posted this issue on english forum only to have wider possible “audience”. I will post my samba config soon (as soon as I find out how to get it :slight_smile: ).
But to your last sentence - I would gladly put some log, configs, etc., but firstly I need to know which of them and how to get it :slight_smile: So, for example - what kind of logs will be helpful?


EDIT: Here it is

	netbios name = turris-nas 
	display charset = UTF-8
	interfaces = lo br-lan 
	server string = Turris Omnia NAS
	unix charset = UTF-8
	workgroup = WORKGROUP
	browseable = yes
	deadtime = 30
	domain master = yes
	encrypt passwords = true
	enable core files = no
	guest account = nobody
	guest ok = yes
	invalid users = root
	local master = yes
	load printers = no
	map to guest = Bad User
	max protocol = SMB3
	min receivefile size = 16384
	null passwords = yes
	obey pam restrictions = yes
	os level = 20
	passdb backend = smbpasswd
	preferred master = yes
	printable = no
	security = user
	smb encrypt = disabled
	smb passwd file = /etc/samba/smbpasswd
	syslog = 2
	use sendfile = yes
	writeable = yes

	comment     = Home Directories
	browsable   = no
	read only   = no
	create mode = 0750

	path = /mnt/hdd1/nas
	read only = no
	guest ok = yes

	path = /mnt/hdd1/petki
	valid users = petki
	read only = no
	guest ok = no
	create mask = 700
	directory mask = 700

	path = /mnt/hdd1/nikuska
	valid users = nikuska
	read only = no
	guest ok = no
	create mask = 700
	directory mask = 700

There is a new samba4 version available for TOS. Try to use that with its default settings? Lots of stuff has changed between samba 3.6 and 4.9.

Thanks for tip, how can I get it? Isnt it automatically upgraded by TOS, with new versions?

It’s explained in Samba4 experience
And no it isn’t, and I don’t know why not.

First i would avoid using WORKGROUP as the name for workgroup. Second using “guest” in combination with “user” security option cause different handling from win10 clients for guest and real users. For “nas” share you can set the access via samba/unix rights , there is no need to use guest=yes option. Also sharing “homes” has additional handling between samba server and win clients (synced users/passwords). You can set it for individual user manually (like you have that per-user share definitions …)

ad_logs: you can increase verbosity of logging to syslog (or you can also define dedicated samba log )
ad_slowness: in some cases (when guest is on), win10 treat user (even correctly authed, but accessing guest share) as guests/nobody and such session sometimes is zombified even if session was correctly closed by client. That can get accumulated and until there is some timeout (for each), you have pretty much slow samba.
Additionally some win clients are having latest samba, while TOS is still pretty old version (so maybe as other suggested, update might help, but you can also force TOS to use SMB1 or SMB2 and not SMB3)

@justsomeguy - thanks, updated, but I have strange issue - after every restart of samba, my custom config /var/etc/smb.conf is replaced by default one. Do you have any idea why?

@Maxmilian_Picmaus - also thanks, so I changed WORKGROUP to TURRIS. To disabling guest - how can I than limit access through samba/unix rights? I set simply to all existing folders/files 777 and add “create mode = 777” under [NAS], or I understood it completely wrong? Sharing homes disabled, it was so or so not wanted. And to the logs - if upgrade to samba4 will not work, I will post them.

Thanks again

There is small difference between unix and samba rights/ownership. (MS is having different masking logic…)
This should be ok for most situation.

    option dir_mask '0775'          ## samba 
    option create_mask '0664'       ## unix 
  • you have to set same or compatible rights/ownership on related shared folder.

… for sure, 0777 is fine when testing,debuging …

@Maxmilian_Picmaus - ok, so set 0775 and 0664 in config, but how to set such rights corresponding to already existing files and folders? Is there any trick, or should I just google it and find some script / chain of commands which will do it?

Btw, to that config overwrite - I found, that the issue is LuCi. I have set values in smb.conf directly, but I did not touch configuration in LuCi, so it was left with default values, which after every restart overwrote config… when I set corresponding values also here in LuCi, everything works.

You can use “recurse” option … chmod -R or/and chown -R

ad_smb.conf: it depends if that config is /tmp/etc/smb.conf (changes are not persistent) or /etc/samba/smb.conf (persistent) or /etc/config/samba(uci template, which is used with persistent config to generate volatile one) … if service is running, any changes without “uci commit” or “luci + save-and-apply” are usually lost. Direct changes in volatile version are lost every reboot or/and restart of samba service.

… as it is a bit hidden in shared posts and linked external sources for expample …: There are options to set min and max protocol “dialects” for server (and for clients).
Here is copy and paste from smb.conf manual.

protocol (max protocol)
  • SMB2 : Re-implementation of the SMB protocol. Used by Windows Vista and later versions of Windows. SMB2 has sub protocols available.

    • SMB2_02 : The earliest SMB2 version.
    • SMB2_10 : Windows 7 SMB2 version.
    • SMB2_22 : Early Windows 8 SMB2 version.
    • SMB2_24 : Windows 8 beta SMB2 version.

By default SMB2 selects the SMB2_10 variant.

  • SMB3 : New label of the SMB2 protocol rewrite with those these sub protocols:

    • SMB3_00 : Windows 8 SMB3 version. (mostly the same as SMB2_24)
    • SMB3_02 : Windows 8.1 SMB3 version.
    • SMB3_10 : early Windows 10 technical preview SMB3 version.
    • SMB3_11 : Windows 10 technical preview SMB3 version (maybe final).

By default SMB3 selects the SMB3_11 variant.

Depending on value(or if default is used) for min or max protocol option, samba daemon will offer/use range of dialects or just one when establishing the connection. Each dialect has cons and pros. I am using SMB2 as max-protocol and default value for min-protocol (just fallback for “rasplex” using only smb1). So far i did not face any issues on network level.

Unless you have a requirement to support higher versions of smb, I wouldn’t touch those options.
I’m also wondering why the OP is running a classical NT4 style domain. Those aren’t supported anymore by modern versions of windows. I also wouldn’t touch options such as receivefile size. I’m not going to outsmart the linux kernel and samba developers.

Where does this elaborate smb.conf come from, why not just use the defaults?

But the main question is, this topic was started with the remark that samba is slow after some time, is that still true?

@Maxmilian_Picmaus - thanks for tips

@justsomeguy - currently, after that upgrade to samba4, it is working more thank week Ok (even better than with old one, where I got max 80 MB/s, what was already sufficient for me, now I am getting 100MB/s over ethernet), I just hope it will stay that way. I also implemented those few tips from Maximilian, like disabling guest, dont know which one helped more (but I assume that upgrade)

I am glad to help. Regarding “which” , hm … my personal favorite one is “guest” option (accompanied with “home” one). :slight_smile: