Disabling Indexing On the Synology DS216+

After 6 years, I finally upgraded my Synology DS209 to a DS216j, and still find indexing to be a problem service that I want to turn off. A few things I found out about how the indexing service is setup on the newer DS216j:

1) Finding the running index processes:
ps ax|grep index
6291 ? SNs 0:00 /usr/syno/sbin/synoindexd
6788 ? SN 0:00 /usr/syno/sbin/synoindexscand
6789 ? SN 0:00 /usr/syno/sbin/synoindexworkerd
6790 ? SN 0:00 /usr/syno/sbin/synoindexplugind
22715 pts/3 S+ 0:00 grep –color=auto index

2) Indexing is controlled through an Upstart job located at /usr/syno/sbin/synoindexd
You can review all Upstart jobs by issuing the command “initctl list”

3) If you want to look at the index job specifically, issue the “initctl show-config synoindexd” command to reveal the specifics of the job:

synoindexd
start on started pgsql-adapter
stop on stopping pgsql-adapter

4) If you want to review the script itself, open the /etc/init/synoindexd.conf file:

description “configure network device”
author “Web Application Team”

start on started pgsql-adapter
stop on stopping pgsql-adapter

expect fork

respawn
respawn limit 5 10

pre-start script

# make sure pgsql is running
if /usr/syno/sbin/synoservice –is-enabled pgsql > /dev/null 2>&1; then
echo “PGSQL service is disabled. Skip…”
stop
exit 1
fi

end script

exec /usr/syno/sbin/synoindexd

post-stop script
echo “Stopping Synology Index Daemon…”
killall synoindexscand > /dev/null 2>&1 || true
killall synoindexworkerd > /dev/null 2>&1 || true
killall synoindexplugind > /dev/null 2>&1 || true
killall synomediaparserd > /dev/null 2>&1 || true
end script

 

Notice that the index script is tied to the Postgresql database start. If you try killing the index service with a “kill -9” command it will kill the process, and then restart it. I have not yet tried, but perhaps the best way to stop the index service is to edit the /etc/init/synoindexd.conf file and change the “start on started pgsql-adapter” line to “stop on started pgsql-adapter.”

I will update this post as I try this solution.

 

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.