Why is Samba Access from Windows So Slow?

43,949

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.

Share:
43,949

Related videos on Youtube

swalker2001
Author by

swalker2001

I am a recent convert to Ubuntu from all things Windoze. I have always been a Linux fan but too scared to make the jump. However, we recently decided to build a Asterisk pbx system at work and that gave me just the excuse I needed to jump in with all fours. I have settled on Ubuntu as my system of choice and use it almost exclusively. Haven't booted any of my machines into Windoze in over three months. Still learning though...a lot I still don't know.

Updated on September 18, 2022

Comments

  • swalker2001
    swalker2001 over 1 year

    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?

    • Admin
      Admin almost 12 years
      How much RAM does the server have? I've found that you can exhaust low RAM servers when viewing a lot of files or copying big files from/to a Samba server.
    • Admin
      Admin almost 12 years
      Another thing to look out for are directories with a bunch of images. If you're using thumbnail view in Windows explorer it will try to build a thumbnail preview of every picture.
    • Admin
      Admin almost 12 years
      Server has 8 gb RAM. And I have only set up one share and it doesn't have any images to speak of in the root of the share. Just getting a directory listing takes forever and more ofen than not, times out. If I go into a directory with only a few files, speed seems fine.
    • Admin
      Admin almost 12 years
      One last issue I've run into is a directory with a lot of executable files, such as Windows program installers. The problem here there is with the antivirus on the Windows clients scanning everything on the network share each time you try to look at it. If you disable scanning the share from your AV, you might get a big improvement.
    • Admin
      Admin almost 12 years
      Your question as asked has a bug in the config file; the SO_RCVBUF and SO_SNDBUF settings need to go on the same line as "socket options =". I've answered your question below assuming you actually have socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
    • Admin
      Admin almost 12 years
      I never solved this problem but finally avoided it by setting the machine up with Turnkey Linux fileserver image. That, of course, uses Samba too. It it lightning fast. Sorry I could never get it to work with Ubuntu. I tried. Wish I knew what I was doing wrong.
  • Nelson
    Nelson almost 12 years
    Ubuntu Server / Linux is a fine way to run a Windows fileserver. Almost every single Windows file server other than Windows itself is running the same Samba code that Ubuntu does. NAS boxes are generally just little Linux boxes running Samba. I wish I could be of more help, sorry.