Tuning your Synology NAS for speed

29 Dec Tuning your Synology NAS for speed

If you own a Synology NAS device at home, you know its an incredible machine for the money. However, it likely has a small amount of RAM (mine has 256MB) and that poses a problem. I have found that if you are not using many of the programs (Disk Station, iTunes server, File Station, etc…), you can free up a great deal of RAM by disabling unused services. This gives precious RAM back to processes that can actually use it, and frees up CPU power.

The first step is to disable services you do not need. For me, this includes all the file indexing and thumbnail services, CUPS printing, USB hotplug, and a few other miscellaneous services. Ensure that SSH access is on (Control Panel – Terminal – Enable SSH Service) and login to the device via SSH.  Then issue the following commands:

/usr/syno/etc/rc.d/S56synoindexd.sh stop
/usr/syno/etc/rc.d/S88synomkflvd.sh stop
/usr/syno/etc/rc.d/S77synomkthumbd.sh stop
/usr/syno/etc/rc.d/S55cupsd.sh stop
/usr/syno/etc/rc.d/S20pgsql.sh stop
/usr/syno/etc/rc.d/S66fileindexd.sh stop
/usr/syno/etc/rc.d/S03hotplugd.sh stop
/usr/syno/etc/rc.d/S03inetd.sh stop
/usr/syno/etc/rc.d/S98findhostd.sh stop

These commands will stop the services from running, but they will restart at the next reboot. To prevent this, simply change the executable status of each service’s start script to be un-executable. This will ensure that disabling these services survives the next reboot. Issue the following commands:

chmod -x /usr/syno/etc/rc.d/S66synoindexd.sh
chmod -x /usr/syno/etc/rc.d/S88synomkflvd.sh
chmod -x /usr/syno/etc/rc.d/S77synomkthumbd.sh
chmod -x /usr/syno/etc/rc.d/S55cupsd.sh
chmod -x /usr/syno/etc/rc.d/S20pgsql.sh
chmod -x /usr/syno/etc/rc.d/S66fileindexd.sh
chmod -x /usr/syno/etc/rc.d/S03hotplugd.sh
chmod -x /usr/syno/etc/rc.d/S03inetd.sh
chmod -x /usr/syno/etc/rc.d/S98findhostd.sh

Note that some of these services might be needed by services you want to run on your DiskStation. You may cherry-pick the services you wish to disable. I only use my DiskStation as a local backup target and have it push to Crashplan, so my requirements are very low. You can reenable a service by using the reverse “chmod +x” command and restarting it.

Next, open the /etc/sysctl.conf file, and add the following network-related settings:

kernel.panic=3
net.core.wmem_max=12582912
net.core.rmem_max=12582912
net.ipv4.tcp_rmem= 10240 87380 12582912
net.ipv4.tcp_wmem= 10240 87380 12582912
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_timestamps = 1

This will provide a number of TCP tunings for the Gigabit ethernet card that the DiskStation uses. After making all of these changes, be certain to reboot the box to clear system RAM and caches. You should find that your DiskStation is now more responsive, and tasks should execute much faster.

 

  • juul

    How can I access the /etc/sysctl.conf file?

    • cosjef

      You need to enable SSH if not yet enabled. Then connect via SSH to the Diskstation to access the file.

      • Juul

        With puty I can connect to my synology, but I don’t know how to edit the file with puty. I also tried FileZilla but I can’t access my synology…. ‘Connection closed by server with exitcode 1

        • cosjef

          Putty lets you connect to the Synology. You need a command-line editor to do the editing of the file. Once SSH’d to the Synology box, try “nano /etc/sysctl.conf”

          • juul

            I get the message -ash nano: not found

          • Supo Orimogunje

            The question being asked is how this is done. I also will like to know how to make synology run a script, and I have searched high and low on google, and nothing seems to come up. All you get is something like “insert this script in your /etc/sysctl” bla, bla, bla; How is this done? A beginner needs more than this!

          • dead

            vi /etc/sysctl.conf
            Here’s a quick guide to VI text editing:
            https://forum.synology.com/enu/viewtopic.php?t=77677

            As it’s a read only file, quitting and saving with :wq won’t work — :!wq is the way to deal with it.

  • juul

    ok thanks

  • John

    Thanks, handy, a comment

    “/usr/syno/etc/rc.d/S56synoindexd.sh stop”

    should be

    “/usr/syno/etc/rc.d/S66synoindexd.sh stop”

    but if you chmod and reboot after it, then it doens’t make a difference.

  • Juul

    Hi, i finally found out how to edit the /etc/sysctl.conf file. Is it correct that you only see this line:

    kernel.panic=3

    ~

    ~

    ~

    I have a synology DS213 with 512 ram, will these tuning setting work for me as wel?

  • GW

    Are there any changes to the network values if you have installed more memory in your Synology? DS412+ with 4GB of RAM. I changed my MTU as well to 9000Bytes. My Macbook Pro screams on a write, about 1GB every 9 seconds. My PC laptop does not get near the same performance. thanks.

    • Andrew Weisz

      >MTU as well to 9000Bytes

      Anyone who does this, you need to make sure your networking gear supports Jumbo Frames. Without enabling it, you’ll get all sorts of headaches.

  • JohnJ

    I have a Synology 213J that I used for the same two purposes: file storage and CrashPlan. I find, however, that even though CrashPlan is running natively, on a gigabit network in the house, and have a 10mb upload pipe, Even with the rest of the household turned off I can’t get better than 3 mbps upload from the NAS at best, and usually sitting somewhere around 2mbps. I would love for this box to take advantage of more of the pipe when nothing else is going on, but have not been able to find settings in either CrashPlan or Synology that would get this rolling. The 213 has 512mb of RAM in it, and I don’t ever seem to use more than about 30% of RAM at any time. What did you do to increase your throughput to CrashPlan?

  • Tomasz Wiszkowski

    Wonderful, i just saw 80MBps upload for the first time ever.
    Thanks for the sysctl tweaks! Particularly useful for everyone with Dual LAN stations!

  • Pete

    Awesome, this fixed my problem of copying going down to 4 MB/s. Now having between 50 and 100 again (depending on filesize ofc). Thx!

  • Frank Doyle

    My system does not seem to be reading the contents of this file after rebooting. Anybody know what the story is?

  • Eric L. Pheterson

    Would you mind updating this for the recent releases of Synology’s OS? There is no longer the directory /usr/syno/etc/rc.d/

  • Daniel Mendes

    My DSM does not have the “/usr/syno/etc/rc.d/” directory. I managed to repeat the steps by doing the sudo chmod -x synoindex* on directory “/usr/syno/sbin”

  • sangorys

    How to disable this service on DSM 5.1. I tried the “/usr/syno/etc/rc.d/S55cupsd.sh stop” but the answer is

    “usage: /usr/syno/etc/rc.d/S55cupsd.sh { reload | add }”