this post was submitted on 01 Jun 2025
35 points (92.7% liked)

Selfhosted

46653 readers
454 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 2 years ago
MODERATORS
 

Fellow self hosting friends, I screwed up. Not only have I deleted Immich's PostgreSQL folder but I also didn't have backups (of the database, of the photos I do).

I've tried to recover the deleted folder but there's not much left even with proper tools. I've checked and the photos are still there, so my question is: Is there a way for immich to rebuild the database with the photos there? Should I start from scratch and re-upload?

you are viewing a single comment's thread
view the rest of the comments
[–] gezero@lemmy.bowyerhub.uk 16 points 1 week ago (1 children)

I am only a solo user that tried similar recovery.

There are several jobs in the admin section, one of them is "migrate the storage template" or something like this. I think that thing might do what you want. I would check that it is set properly depending on what you were using previously and rerun in. https://immich.app/docs/administration/storage-template/

I also wanted to mention that normally Immich dumps its own db into a file backup file somewhere. I forgot where. Check the database dump backup cron job in the settings.

[–] witx@lemmy.sdf.org 13 points 1 week ago* (last edited 1 week ago)

I also wanted to mention that normally Immich dumps its own db into a file backup file somewhere. I forgot where. Check the database dump backup cron job in the settings

Hi, thank you. This was the solution. Immich was storing its backup files to DB_UPLOAD (as defined on the .env) file. There will be a backup folder with a bunch of .sql.gz files) Picked one and ran the following command

gunzip --stdout "/path/to/backup/dump.sql.gz"
| sed "s/SELECT pg_catalog.set_config('search_path', '', false);/SELECT pg_catalog.set_config('search_path', 'public, pg_catalog', true);/g"
| docker exec -i immich_postgres psql --dbname=postgres --username=<DB_USERNAME>

As documented on immich' s website