Ubuntu – Why is Samba Access from Windows So Slow

file-serverfile-sharingsambawindows

I have set up a file server using Ubuntu 12.04 Server. The purpose is to serve several network drives to Windows users that have heretofore been served by numerous NAS drives.

I have Samba set up with one share defined so far. I can connect to it fine from my test Windows 7 and Windows XP machines.

When I do a directory listing on the share from Windows, it can take up to two minutes to get all the files listed–would have taken about 1.5 seconds when I was using the Buffalo NAS. Sometimes it times out with no response at all.

I have used the default smb.conf and simply added the following for the share I have set up so far:

[engineering]
comment = Ubuntu File Server Share
path = /networkdriveshares/engineering
browsable = yes
guest ok = yes
read only = no
create mask = 0755

I have tried changing the workgroup setting to the Active Domain name our Windows computer use but didn't notice any difference.

The only other change I made to the default smb.conf was adding in the recommended socket settings:

     SO_RCVBUF=8192 SO_SNDBUF=8192
     socket options = TCP_NODELAY

Lots of information about slow Samba shares online but I have tried all of the solutions I have found and none have made a lick of difference. If there is no solution, is there a better way to set up a file server to be used by Windows clients?

Best Answer

Try configuring your server without setting SO_RCVBUF and SO_SNDBUF. Ie:

socket options = TCP_NODELAY

and nothing else. Or comment out socket options entirely and use Samba's default.

I had a similar problem with Ubuntu 12.04 and a Mac client on gigabit ethernet. Reading a file was getting about 100kbytes/second, or 300 times too slow. In Ubuntu 11.10 I was setting both buffers to 8192 as you tried. But when I upgraded to 12.04 I found I had to remove that setting to get performance back to where it should be (about 30mbytes/second, the disk speed).

Another solution I've seen suggested is to set max protocol = NT1. I tried that first and it didn't help me.

Related Question