The short answer is that “restore the database index” means different things depending on which Synology database is damaged. For Synology Photos, the supported fix is to re-index from the Photos app or reinstall the package; for media libraries, you re-index the media folder; for DSM system databases such as PostgreSQL, you restore from a Hyper Backup archive or repair query the database directly over SSH. The key condition: identify the failing component first, because re-indexing Photos does not touch the DSM system database and vice versa. As of late 2026, DSM 7.2 and 7.3 remain the mainstream versions, so the steps below reflect those interfaces, with notes where DSM 7.3 moved things.
This guide gives ordered procedures for each case, what success looks like, and when to stop and escalate.
Which Synology database index actually needs restoring?
Synology does not have one single “database index.” DSM uses several storage layers, and the phrase in forum posts usually refers to one of four things:
1: The Synology Photos index. A searchable catalog of photos and videos: thumbnail metadata, face recognition data, GPS tags, and object recognition. If Photos shows “No items found,” search returns nothing, or thumbnails fail to generate, this index is the likely culprit. 2: Media library indexes. Indexing used by Synology Drive, Video Station (on older DSM versions), Audio Station, and DLNA/Media Server. Symptoms: files exist in File Station but don’t appear in the library app. 3: The DSM system database. A PostgreSQL instance that stores package configuration and app metadata. Corruption here produces package crashes, DSM update failures, or errors like “postgres could not be started.” 4: A Docker-hosted database. If you run MariaDB, PostgreSQL, or another database inside Container Manager, that database’s own index is your responsibility, and Synology’s GUI tools won’t rebuild it.
Getting the diagnosis right matters because the recovery paths diverge sharply. Re-indexing a library is low-risk and reversible; repairing the system database touches infrastructure and should be preceded by a backup. Before doing anything, note your DSM version in Control Panel > Info Center, and confirm that the storage volume holding the database is healthy in Storage Manager. A volume in a degraded RAID state can look like database corruption, and re-indexing on failing disks makes things worse.
Before you start: prerequisites for any rebuild
Administrator access to DSM and the package in question. Standard users cannot trigger re-indexing. Free space on the target volume. Photo re-indexing can temporarily consume several GB on large libraries because thumbnails and recognition data are regenerated. A rough planning figure is a few hundred MB per 10,000 photos, but this varies with image size and whether video is included; check actual free space rather than trusting a fixed number. A current Hyper Backup or snapshot. For the system database, a backup is not optional. Synology’s own guidance for database repair assumes you can restore if a step fails. SSH enabled only if you’ll use it. Control Panel > Terminal & SNMP. Disable it again afterward. Patience for large libraries. Re-indexing tens of thousands of photos can take hours to days, and running it during off-hours avoids competing with other I/O.
One important nuance: re-indexing is not the same as re-installing. Re-indexing keeps your folder structure, albums, and sharing settings and rebuilds the searchable catalog. Reinstalling the package can reset settings, so treat it as the heavier option and use it only when re-indexing fails.
Restoring the Synology Photos index from within the app
This is the correct first move for Photos-specific symptoms. The result to expect: after the scan completes, the timeline repopulates, search works again, and face/object recognition data is rebuilt over time (recognition typically finishes after the base index).
1: Sign in to DSM as an administrator and open Synology Photos. 2: Go to Settings (the gear icon), then Indexing (in some DSM 7.3 builds the label is Personal Library or the indexing section under the admin console; browse both if the exact wording differs). 3: Review the indexed folders. If the shared photo folder is missing from the list, add it first, because no amount of re-indexing will find files in an unindexed folder. 4: Start Re-index for the affected space (Personal Space or Shared Space). Confirm the prompt. 5: Leave the NAS powered and connected. Indexing continues in the background; the progress indicator appears in the indexing or notification area. Avoid restarting DSM mid-scan, since an interrupted scan can leave the catalog partially built and require another pass. 6: When the scan finishes, open the timeline and use search for a known filename and a known face. Those two checks confirm both the file index and the recognition pipeline.
If the button is greyed out or the scan stalls at a fixed percentage for many hours, the catalog itself may be damaged beyond what the UI can repair. In that case, stop the scan, note the timestamp, and move to the package reinstall method below. A stalled progress bar combined with repeated “indexing service stopped” alerts is the signal to change approach.
Reinstalling Synology Photos when re-indexing won’t complete
Reinstall preserves your photo files on disk; what you lose is app-level configuration, and the index is rebuilt from scratch. Check your album and sharing settings before proceeding if you have customized them.
1: In Package Center, open the installed Synology Photos entry and choose Uninstall. Read the confirmation carefully: ensure any option to keep the photo database/settings is selected if offered, and know that the shared folder contents are not deleted either way. If you are unsure, stop and make a Hyper Backup of the package first. 2: Reinstall Synology Photos from Package Center. 3: Reopen the app and re-enable indexing for the same folders, then let the background scan complete. 4: Verify with a filename search, a location search, and a face search after recognition has had time to run.
Success looks like a clean timeline with thumbnails loading progressively. A partial timeline that stalls again after a reinstall points to something upstream: insufficient space, a permissions problem on the photo folder, or a filesystem issue. Check Storage Manager and file permissions before repeating the process a third time.
Rebuilding media library indexes in Synology Drive and media packages
For Synology Drive, the index lives in the team folder settings and can be rebuilt without reinstalling. The typical fix for “files missing from Drive” or “sync shows phantom files” is to re-index the team folder:
1: Open Synology Drive Admin Console. 2: Select the team folder that’s misbehaving and choose Re-index. The scan status is visible in the console. 3: For individual users, the client can also clear and rebuild its local sync database, but do that only after the server-side re-index finishes.
For DLNA and media servers, the index is regenerated from Control Panel > Media Indexing (or the Media Server package settings, depending on which package is installed): select the folders, save, and let indexing run. On DSM versions where Video Station is still installed, its library has a separate re-index option in Settings. Note that support for older media packages varies by DSM version; if a package no longer exists for DSM 7.3, that is a version difference, not corruption, and the intended replacement varies by package.
Repairing the DSM system PostgreSQL database over SSH
Use this path only for system-level symptoms: PostgreSQL fails to start, package installation errors cite the database, or Hyper Backup task creation fails with database errors. This touches the infrastructure that packages depend on, so a Hyper Backup of system configuration is the prerequisite, and a snapshot of the system volume is better.
The supported tools on DSM are the PostgreSQL utilities bundled with DSM and Synology’s own guidance for the postgres user. The general sequence:
1: Enable SSH, connect as an administrator (or as root after sudo -i), and confirm the PostgreSQL service state: synopkg status PostgreSQL (or pkgctl on older builds) reports whether the service is running. 2: If it is stopped, attempt a clean start first: synopkg start PostgreSQL. If it fails, capture the exact error text before going further, because the message determines whether this is a permissions problem, a disk problem, or true corruption. 3: For corruption symptoms, run PostgreSQL’s consistency check against the affected database using the server’s own tools (for example, the pg_dump/psql round trip, or an integrity check against the data directory). Which database name and path apply depends on the package that’s failing, so read the error message rather than guessing. 4: If the check reports damage and you have a Hyper Backup archive, the reliable repair is to restore that archive through Hyper Backup rather than hand-editing the data directory. Hand-repairing a PostgreSQL data directory is not a supported Synology workflow, and partial repairs can leave packages in an inconsistent state. 5: If no backup exists, open a support ticket with Synology before deleting or recreating anything under the PostgreSQL data path. Removing database files without the matching package reconfiguration leaves packages broken.
Stop condition: if the service fails to start after a clean start and a restore attempt, or if Storage Manager shows volume or disk health warnings, stop and address the storage layer with Synology support. No amount of database repair fixes failing hardware, and repeated repair attempts on a degraded volume can cause data loss.
There is a second system database to be aware of: DSM stores package and configuration data in its own internal databases, and some apps (notably older versions of Surveillance Station and MailPlus) maintain separate databases. Each has its own restore path through its package settings or Hyper Backup. The principle is the same: prefer the package’s restore/repair UI or a backup restore over manual manipulation.
Restoring indexes in Docker-hosted databases on your NAS
If your “database” runs inside Container Manager, Synology’s tools won’t help. You restore the index using that database engine’s own commands, executed inside the container:
PostgreSQL: use REINDEX DATABASE or REINDEX TABLE from psql, ideally during a maintenance window, and verify with pg_dump afterward. MariaDB/MySQL: use REPAIR TABLE or OPTIMIZE TABLE, or rebuild the index definition if the index itself is missing rather than corrupt. SQLite-based app stores: rebuilding usually means recreating the index with the app’s own command or restoring the file from backup.
The prerequisite here is that the container’s data volume is mapped to a persistent NAS folder and that you have a backup of that folder. A docker compose down followed by restoring the data directory is often more reliable than in-place repair, especially for SQLite files. If you’re unsure which engine you’re running, check the container image name rather than guessing.
Verifying the restore and preventing repeat corruption
Verification differs by case, but the pattern is: exercise the feature that was broken, then confirm the underlying data is intact.
Photos: search for a filename and a location, open an album, and confirm thumbnails render. Recognition checks can take longer; confirm faces appear after the recognition pass completes. Drive/media: confirm files that were missing now appear, and that sync status on a test client is clean. System database: confirm the failing package starts, a backup task runs to completion, and DSM reports no database alerts in Log Center. Docker databases: run the engine’s consistency check and a test query against the repaired table.
Prevention is mostly about avoiding interrupted writes and disk problems: keep a Hyper Backup schedule for system configuration and package data, use snapshots on Btrfs volumes, leave adequate free space (indexes need room to grow during rebuilds), and avoid hard power-offs during indexing. If corruption recurs without an obvious cause, check disk health and cabling before assuming a software bug.
FAQ
Does re-indexing Synology Photos delete my albums and shares? No. Re-indexing rebuilds the searchable catalog; album membership and share links are stored separately in most configurations, but the safe practice is to note your share settings and take a package backup before any reinstall, which is the step that can reset app configuration.
How long should a photo re-index take? There’s no reliable fixed rate; it scales with file count, video content, and NAS model. Expect hours for large libraries and plan to leave the NAS uninterrupted. If progress hasn’t moved at all for many hours, treat it as a stall and switch methods.
Can I restore just the index from Hyper Backup? Hyper Backup restores the package’s data, which typically includes the index alongside other app data. That means the restore can bring back the index and your settings together, which is usually what you want. Restoring only selected files from an archive is possible in some cases but not a supported way to repair a corrupt system database.
Is it safe to run database repair commands while packages are running? No. Stop the affected package or database service first, confirm the service is stopped, and keep a backup. Repairing live databases risks further inconsistency.