New to Busy?

Synlogy Diskstation Delete Universal Search Database

1 comment

5 months ago3 min read

Universal Search is one of the most resource intensive jobs that will ever run on a Synlogy Diskstation. A full index can easily take several weeks to complete and can make a Diskstation with only 1GB of memory unusable.

As Synlogy Drive Sync, Synlogy Drive and Calendar all depend on Universal Search often deinstalling the troublesome service isn't an option.

Delay Index

If a Diskstation only got 1GB of memory it's best to delay the index forever and keep it that way until you add a memory upgrade:



In addition to being resource hungry the Universal Search index is also prune to corruption. You can check the database for errors:


And if errors are found use the reindex function to fix them:


It's also advisable to index only the filenames and to deactivate scanning file content:


Delete the Index Database

Sometimes even a reindex won't help and and a database delete is needed. One way to do this is deinstall Universal Search. For this you have to deinstall all services depending on Universal Search first. Which is quite cumbersome.

The other way is to delete the database using psql and ssh.

WARNING: From this point onwards you need advanced Linux skills. If you don't know how to use ssh, sudo or su you should stop reading. I will take no responsibility if you brick your Diskstation.

This following script will delete the «mediaserver» database. For this two user changes are needed:

  1. First the script elevates itself to root privileges to stop and later start the search service.
  2. Then the script demotes itself to postgres privileges to delete the database.

Needless to say that a lot can go wrong here. Since you have advanced Linux skills you probably decided not to trust me and to execute every command separately. Just to be sure. I would do the same.


# get the real name of the currently running script
Script="$(readlink -f ${0})"

echo execute «${Script}» as «${USER}»

if test "${USER}" = "postgres"; then
    # stop any index process still running and then delete
    # the «mediaserver» database.
    /bin/psql <<-EOF
        SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = 'mediaserver';
        DROP DATABASE mediaserver;
elif test "${USER}" = "root"; then
    # Function to stop a Synlogy service.
    function Stop ()
        local in_Package="${1}"

        synopkg stop        "${in_Package}"
        synoservice --stop  "pkgctl-${in_Package}"
    # Function to start a Synlogy service.
    function Start ()
        local in_Package="${1}"

        synopkg start        "${in_Package}"
        synoservice --start  "pkgctl-${in_Package}"

    # Stop Quick Search (internally called SynoFinde). This
    # will also stop all services dependent on Quick Search
    Stop SynoFinder

    # Call the current script as postgres user.
    su --command "${Script}" - postgres

    # Start Quick Search (internally called SynoFinder).
    Start SynoFinder
    # Call the current script as root user.
    sudo ${Script}


For each right there is an equal and opposite obligation.



Sort byBest