Getting the most out of your Synology DiskStation NAS (network attached storage device)

Synology Tools

Synology Aug 24, 2021

Synology is sometimes treated like it's simply another regular Linux distro, but that's not accurate. There are certain packages and options available to Debian etc. that are either not common, or just not possible on Synology.

Below are some lesser known ways to get access to a bunch of helpful tools:

Synogear Diagnosis Tool

This includes around 30 different tools which can be used out of the box.

  1. SSH into your synology machine
  2. Type in
sudo synogear install
you will normally need to enter your password again after a sudo command

This will put you into [email protected][NASname]:/volume1/homes/[USER]. For some reason this doesn't persist between sessions, so each time I've wanted to use a tool from the list below from a new session, I've had to run step 2 above again.

To see a list of all the tools available, type in

synogear list

To run any of the tools, type the following:

/var/packages/DiagnosisTool/target/tool/[toolname] --[argument]

In general, most tools won't need an argument to run, for instance you can load up nethogs by typing

/var/packages/DiagnosisTool/target/tool/nethogs

My favourites at the moment are htop(normally already available on Synology machines) nethogs, and iftop. If you need to find out what anything listed does, google is your friend:

addr2name
arping
bash
cifsiostat
clockdiff
dig
domain_test.sh
file
fix_idmap.sh
free
fuser
gcore
gdb
gdbserver
iftop
iostat
iotop
iperf
iperf3
kill
killall
ldd
log-analyzer.sh
lsof
ltrace
mpstat
name2addr
ncat
ndisc6
nethogs
nfsiostat-sysstat
nmap
nping
nslookup
peekfd
perf-check.py
pgrep
pidof
pidstat
ping
ping6
pkill
pmap
prtstat
ps
pstree
pwdx
rarpd
rdisc
rdisc6
rltraceroute6
rview
rvim
sa1
sa2
sadc
sadf
sar
sid2ugid.sh
slabtop
sockstat
speedtest-cli.py
strace
sysctl
sysstat
tcpdump
tcpdump_wrapper
tcpspray
tcpspray6
tcptraceroute6
telnet
time
tload
top
tracepath
traceroute6
tracert6
uptime
vim
vimdiff
vmstat
w
watch
xxd

This process used to be part of File Finder but not too long ago was turned into its own package. Some users don't want or need this, and others may want to simply disable it at times as it can be very CPU heavy when running.

It cannot be disabled or removed from Package Finder, so the following are some simple SSH commands which can be used instead from root:

  • Enter root mode (type in your password when prompted):
sudo su -
  • To disable the package:
synoservicecfg --disable pkgctl-SynoFinder
  • To completely remove the package:
synopkg uninstall SynoFinderopkg
  • To re-enable the package:
synoservicecfg --enable pkgctl-SynoFinder
disabling (and by extension removing) Universal Search will also affect the functionality of your Synology Drive package due to dependencies the latter has on the former

DSM7 UPDATE:

It seems that the synoservicecfg command has been removed in DSM7. To check whether your Universal Search is enabled or not, the new command is:

synopkg status SynoFinder

This will return something like SynoFinder package is stopped and a status number.

The uninstall command remains the same.


Task Scheduler

The Task Scheduler allows you to create tasks which run automatically at a given time or frequency (called a Scheduled Task) or by an event such as boot up (called a Triggered Task).

Normally if you're doing something which requires a scheduled task to be created, it will run you through the steps, however the basics:

  • Open Control Panel. In the search bar type and then select Task Scheduler
A list of tasks already created, either by packages or by the user

This will open a list of all your schedule tasks, showing what they do, what they're for, and when they're next set to run. Let's say we wanted to create another, for instance clearing the swap file which we want to run once a day at 5am:

  • Click Create --> Scheduled Task --> User-defined script
creating a scheduled task
  • Add a name for the task in the General tab, you can leave the user as root if desired and toggle the Enabled checkbox as necessary, then select the Schedule tab:
the 'Schedule' tab
  • Leave the date as Daily, and change the First run time to be at 5am, Frequency to daily, and Last run time to 5am. Select the Task Settings tab:
the 'Task Settings' tab
  • We define the Run Command in the field in one of two ways. We can either paste our script directly into it or:
using a .sh file as the run command 
  • We create and save the .sh which contains the script, and reference that by 'bash'ing into it:

If you've got your emails set up you can use the tick-boxes on this page to be notified when it runs and/or terminates abnormally.

Once created and you're back on the screen showing the list of tasks, you can right-click on the task, select Run, and if everything has been done correctly you should find that the task has run and the intended action has been started.


Preshared Keys and more - SSH on Linux and Synology
An easy guide which explains how to access and use your SSH sessions to their fullest, including clients and logging in with preshared keys

PTS

PTS fell down the selfhosted rabbit hole after buying his first NAS in October 2020, only intending to use it as a Plex server. Find him on the Synology discord channel https://discord.gg/vgSq5pcT

Have some feedback or something to add? Comments are welcome!

Please note comments should be respectful, and may be moderated