GUIDE, WITHOUT THE GUESSWORK

Moving Immich and Nextcloud Data Without Corrupting App-Owned State

Copying an app's files by hand is how migrations break. Immich and Nextcloud own a database and an index alongside the files — move all of it together, or not at all.

Moving Immich and Nextcloud Data Without Corrupting App-Owned State

The most common way a self-hosted migration goes wrong: someone rsyncs the photos or files directory to the new server, points the app at it, and waits for everything to show up. With Immich and Nextcloud, it doesn't — because for those apps the files on disk are only part of the truth.

The files are not the whole app

Immich and Nextcloud both maintain app-owned state that has to stay consistent with the files:

Copy the files alone and you get a new install that can't see them, duplicate entries, broken shares, or — worst case — a database that points at paths that no longer exist. The data isn't lost; the app just no longer believes the right things about it.

Move everything, consistently, at one point in time

The rule is: migrate the database, the files, and any index/cache as one consistent snapshot, with the app stopped.

  1. Stop the app (and its workers) so nothing writes mid-copy.
  2. Dump the database with the app quiesced (pg_dump for Immich's Postgres; mysqldump/pg_dump for Nextcloud).
  3. Copy the data directory after the dump, so files and DB reflect the same moment.
  4. Restore both on the new host, then let the app reconcile (Nextcloud: occ files:scan; Immich: let the jobs re-run).

A consistent snapshot beats a clever live copy every time. If you've never rehearsed the restore side, do it once on a throwaway target first — a volume restore drill turns "I think this backup works" into "I've watched it come back."

Prefer app-native migration paths

Both apps give you tools that respect their own state — use them instead of going around them:

Going through the app's tooling is what keeps the index and the files agreeing.

Deploy the target cleanly first

Migrations are smoother when the destination is a known-good install rather than a hand-assembled one. Bringing the app up from a template gives you the right database, volumes, and version before you pour data in:

ServerCompass selecting the Immich app template from its catalog Standing up a clean Immich target in ServerCompass — app, database, and storage provisioned together so the restore lands on matching infrastructure.

Don't forget the boring blockers

Takeaway

Immich and Nextcloud are database-plus-files applications wearing a folder. Treat the database, the files, and the index as one unit, move them together with the app stopped, restore into an equal-or-newer version, and let the app rebuild its caches. Bypass that and you're not migrating data — you're manufacturing a corruption incident.

From across the StoicSoft network

Hand-curated reads on the same topic from sister sites in the StoicSoft family.