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

Run initial migration processing off the RPi

If there are a lot of files that need to be migrated, the initial CPU intensive processes might cause the RPi to overheat and shutdown. To avoid this, we will spin up an immich server instance on a more powerful machine, such as a laptop/desktop, using the same external hard disk used for the RPi. Media assets are then imported to this local server for processing. Once finished, we will use the external drive in our RPi server setup.

  1. Follow setup step 1 to encrypt the external drive.
  2. Mount the encrypted drive to your machine.
  3. Use lsblk to get the mount point path to the drive.
  4. Create a .env file containing the snippet content below.
    • Change the DRIVE_PATH the to mount point path of the external drive.
    • Change the DB_PASSWORD.

      Caution

      Securely store the DB_PASSWORD. This is necessary to recover the database which is essential to make sense of our backup.

    # Connection secret for postgres. You should change it to a random password
    # Please use only the characters `A-Za-z0-9`, without special characters or spaces
    DB_PASSWORD=changeThisPassword
    
    # The path to the root of your external drive
    DRIVE_PATH=/run/media/<user>/immich_drive
    
    # To set a timezone, uncomment the next line and change Etc/UTC to a TZ identifier from this list: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List
    # TZ=Etc/UTC
    
    # The Immich version to use. You can pin this to a specific version like "v2.1.0"
    IMMICH_VERSION=v2
    
    # Do not change the following values
    ###################################################################################
    
    # The location where your uploaded files are stored
    UPLOAD_LOCATION=${DRIVE_PATH}/immich_data
    
    # The location where your database files are stored.
    DB_DATA_LOCATION=${DRIVE_PATH}/postgres_not_rpi
    
    DB_USERNAME=immich # set to `immich` to match the hardcoded user set in the nix immich service.
    DB_DATABASE_NAME=immich
    

    Note

    It may be possible to use the UPLOAD_LOCATION and DB_DATA_LOCATION directories generated by your machine on the RPi. However, this is likely to be a smooth transition only if you are creating your immich instance on another NixOs with the same version of immich and postgres.

  5. Follow immich instructions to setup an immich instance on your machine with the newly created .env file.
  6. Migrate your photos and videos.
  7. Create a backup of the database.
  8. Setup the RPi server
    1. Setup the RPi following setup step 2.
    2. Setup immich following setup step 3, Raspberry Pi up to and including step 7.

      Important

      Use the same DB_PASSWORD used in step 4 above.

    3. Restore the database following Recovery From Cloud Storage steps 7 to 9.
    4. Configure backups following setup step 4
    5. Setup remote access following setup step 5