Home Tweaks • Optimizing Samba on your NAS

Optimizing Samba on your NAS

 - 

The most common used software on a NAS would be Samba i guess, since that’s what a NAS is for, but with the default configuration there is not much transfer speed to expect.

In this short post i’ll show some performance tuning tips regarding Samba:

There are 3 main rules that should exist in your configurationfile, however, these are not here by default, the 3 options are:
read raw = yes
write raw = yes
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=65536 SO_SNDBUF=65536

The Samba config file is in:
/etc/samba/smb.conf

read raw
Read raw will read the raw data instead of the contents in that file, using this will not work on older systems (PC’s) but for the systems i’ve tested it on, it all worked. Using this method will reduce the CPU load, because it does not have to check what data it is.

write raw
Same as above, but this time for writing data to disk. Will reduce CPU load as well.

socket options
These are the socket options for Samba, most important being the receive and send buffers, which will speed up transfers by a maximum of 200%! My NetworkSpace was reading data with 28 Mb/sec and with the default is was around 20 Mb/sec, on this part no 200% gain, but there are reported systems (especially high end) where these results lead to, so why not have them on your NAS. The first 2 options will reduce the network delay caused by Samba and will reduce CPU waiting time. On my NetworkSpace the CPU load dropped big time and does not top out that much anymore leading to a stabile connection.

When you are done and saved your setting, be sure to restart Samba for the changes to take effect:
/etc/init.d/samba restart (on some systems that is smb instead of samba)

In Tweaks

Author:langerak

2 responses to “Optimizing Samba on your NAS”

  • Chris 09-03-2011 at 19:28 Reply 

    Have you tried with NFS?


    • langerak 11-03-2011 at 08:00 Reply 

      NFS is a nice alternative, however does not support authentication and goes bad with Windows, with some of my users. There are some Unix essentials, but should not need that, so Samba for this is a good option. Thanks for the tip tho! Maybe i can add a post about NFS soon :).


Leave a Reply

Your email address will not be published. Required fields are marked*

*

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.