Disaster recovery
This chapter covers recovering your immich setup from backups. These instructions cover two distinct situations.
- Recovery From Cloud Storage: Setting up the external drive, RPi and getting data backed-up on cloud storage.
- Recovery From External Drive: The external drive data is intact and can be used as is. Setting up of RPi.
Recovery From Cloud Storage
- Encrypt the new drive following setup step 1.
- Setup the RPi following setup step 2.
- Setup immich following setup step 3, Raspberry Pi up to and including step 8.
- Stop the immich-backup timer from triggering.
sudo systemctl stop immich-backup.timer - Configure
rusticfollowing setup step 4, up to and including step 2. - Recover the data from the cloud. Note You can add
--dry-runto see what would be restored.rustic restore latest /mnt/immich_drive/immich_data - Restore the database from the latest backup in
immich_data/backups- Start postgres, the database
sudo systemctl start postgresql- restore backup
gunzip -c /mnt/immich_drive/immich_data/backups/<latest dump> | sudo -u postgres psql -d postgresImportant
If your database backups where created from a database with a user other than
immich, such as the default docker immich configuration whereDB_DATABASE_NAME=postgres, grant equivalent permissions toimmichas that user with:sudo -u postgres psql -c "GRANT <DB_DATABASE_NAME of old DB> TO immich;"- Ensure correct permissions to immich_data
sudo chown -R immich:users /mnt/immich_drive/immich_data - Start immich
immich-server --start --no-decryption - Access the server and confirm that the backup is complete.
Note
If you only backed up essential files, your RPi might need some processing time.
- Restart the immich-backup timer
sudo systemctl start immich-backup.timer - Run the following command and follow the URL output to register the RPi on tailscale.
sudo tailscale up
Recovery From External Drive
These instruction are for when the external drive already contains all the immich data of a previous server instance.
Caution
For this to work, the old and new postgres versions will need to match. There may be other nuances that might cause this to fail. If it does, you can always use the data in the drive to backup the database. You can follow the Migration Processing Off RPi procedure starting from step 8.
- Setup the RPi following setup step 2.
- Setup immich following setup step 3, Raspberry Pi up to and including step 3.
- Start immich
immich-server --start --no-decryption - Access the server and confirm that all the photos are there.
- Run the following command and follow the URL output to register the RPi on tailscale.
sudo tailscale up