Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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

  1. Encrypt the new drive following setup step 1.
  2. Setup the RPi following setup step 2.
  3. Setup immich following setup step 3, Raspberry Pi up to and including step 8.
  4. Stop the immich-backup timer from triggering.
    sudo systemctl stop immich-backup.timer
    
  5. Configure rustic following setup step 4, up to and including step 2.
  6. Recover the data from the cloud. Note You can add --dry-run to see what would be restored.
    rustic restore latest /mnt/immich_drive/immich_data
    
  7. Restore the database from the latest backup in immich_data/backups
    1. Start postgres, the database
    sudo systemctl start postgresql
    
    1. restore backup
    gunzip -c /mnt/immich_drive/immich_data/backups/<latest dump> | sudo -u postgres psql -d postgres
    

    Important

    If your database backups where created from a database with a user other than immich, such as the default docker immich configuration where DB_DATABASE_NAME=postgres, grant equivalent permissions to immich as that user with:

    sudo -u postgres psql -c "GRANT <DB_DATABASE_NAME of old DB> TO immich;"
    
    1. Ensure correct permissions to immich_data
    sudo chown -R immich:users /mnt/immich_drive/immich_data
    
  8. Start immich
    immich-server --start --no-decryption
    
  9. 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.

  10. Restart the immich-backup timer
    sudo systemctl start immich-backup.timer
    
  11. 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.

  1. Setup the RPi following setup step 2.
  2. Setup immich following setup step 3, Raspberry Pi up to and including step 3.
  3. Start immich
    immich-server --start --no-decryption
    
  4. Access the server and confirm that all the photos are there.
  5. Run the following command and follow the URL output to register the RPi on tailscale.
    sudo tailscale up