Immmich

immich

Immich Relocation

I've had to move Immich twice, one time from a single disk to a ZFS RAID and another time because the root directly of my VM was too small and kept filling up and crashing. The process is not so hard but needed to be slightly adjusted for my situation.

Backup

This part is exactly as the Immich documentation describes

stuart@photos:~$ sudo docker exec -t immich_postgres pg_dumpall --clean --if-exists --username=postgres | gzip > "immich.sql.gz"

Move the .gz file to the Immich root location and change into that directory.

Restore

These instruction are copied from the documentation but adjusted to include sudo in a couple of places. First, rsync the following content to the new location, the postgres folder is not needed as that will be recreated. In my situation everything was under /immich and I used the same directory on the new disk, it's not clear to me if this process can be used to move to a new directory in combination with the UPLOAD_LOCATION parameter.

  • library folder
  • docker-compose.yml file
  • .env file

stuart@photos:~$ sudo docker compose down -v
stuart@photos:~$ sudo rm -rf postgres
stuart@photos:~$ sudo docker compose pull
stuart@photos:~$ sudo docker compose create
stuart@photos:~$ sudo docker start immich_postgres # wait a few seconds for postgres to start

# This is one command
stuart@photos:~$ gunzip --stdout "./immich.sql.gz" \
| sudo sed "s/SELECT pg_catalog.set_config('search_path', '', false);/SELECT pg_catalog.set_config('search_path', 'public, pg_catalog', true);/g" \
| sudo docker exec -i immich_postgres psql --dbname=postgres --username=postgres
stuart@photos:~$ sudo docker compose up -d

Previous Post Next Post