#migrating from one server to another esrver

1 messages · Page 1 of 1 (latest)

twin rapidsBOT
#

:wave: Hey @gaunt oasis,

Thanks for reaching out to us. Please carefully read this message and follow the recommended actions. This will help us be more effective in our support effort and leave more time for building Immich immich.

References

#

Checklist

I have...

  1. :blue_square: verified I'm on the latest release(note that mobile app releases may take some time).
  2. :blue_square: read applicable release notes.
  3. :blue_square: reviewed the FAQs for known issues.
  4. :blue_square: reviewed Github for known issues.
  5. :blue_square: tried accessing Immich via local ip (without a custom reverse proxy).
  6. :blue_square: uploaded the relevant information (see below).
  7. :blue_square: tried an incognito window, disabled extensions, cleared mobile app cache, logged out and back in, different browsers, etc. as applicable

(an item can be marked as "complete" by reacting with the appropriate number)

Information

In order to be able to effectively help you, we need you to provide clear information to show what the problem is. The exact details needed vary per case, but here is a list of things to consider:

  • Your docker-compose.yml and .env files.
  • Logs from all the containers and their status (see above).
  • All the troubleshooting steps you've tried so far.
  • Any recent changes you've made to Immich or your system.
  • Details about your system (both software/OS and hardware).
  • Details about your storage (filesystems, type of disks, output of commands like fdisk -l and df -h).
  • The version of the Immich server, mobile app, and other relevant pieces.
  • Any other information that you think might be relevant.

Please paste files and logs with proper code formatting, and especially avoid blurry screenshots.
Without the right information we can't work out what the problem is. Help us help you ;)

If this ticket can be closed you can use the /close command, and re-open it later if needed.

hollow oyster
#

You can follow this guide to get the database information restored on the new instance

gaunt oasis
#

thank ytou

#

its mandatory that I move the entire libary over to the new vm right?

hollow oyster
#

yes, if you don't want to do any processing all over again

gaunt oasis
#

thanks boss

pine willow
#

Side note: database on an NFS mount is a bad idea

gaunt oasis
#

What if the NFS share is just a folder in the same nas that I made the linux vm?

#

I have a linux VM on a QNAP nas that im running immich on. I also have a NFS share on the same nas that I mounted on to the linux vm

gaunt oasis
#

# The location where your uploaded files are stored
UPLOAD_LOCATION=/mnt/immich/immich-backup/library

# The location where your database files are stored. Network shares are not supported for the database
DB_DATA_LOCATION=./postgres

# 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

# 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=postgres

# The values below this line do not need to be changed
###################################################################################
DB_USERNAME=postgres
DB_DATABASE_NAME=immich```

this is my current .env on the new instance.
#

My concern here is with the DB_DATA_LOCATION

gaunt mist
gaunt oasis
#

oh ok

gaunt oasis
#

do my DB_DATA_LOCATION can be anywhere in the new vm?

#
total 145880915
-rwxrwxrwx+ 1 concac users 370688187 Dec  5 01:01 2LGZ4O~P.GZ
-rwxrwxrwx+ 1 concac users 370648539 Dec  4 01:01 2AP8JZ~K.GZ
-rwxrwxrwx+ 1 concac users 370590457 Dec  3 01:01 2HPVAY~7.GZ
-rwxrwxrwx+ 1 concac users 370519893 Dec  2 01:01 2Y3LGL~I.GZ
-rwxrwxrwx+ 1 concac users 370507919 Dec  1 01:01 25FLGK~L.GZ
-rwxrwxrwx+ 1 concac users 370489276 Nov 30 01:01 24XAY3~8.GZ```
#

this is where my db-back up is at

#

so lets say i want to use the latest file 2LGZ4O~P.GZ

#

gunzip < "/mnt/immich/immich-backup/db-baclup/2LGZ4O~P.GZ" | docker exec -i immich_postgres psql --username=${DB_USERNAME}

#

this would be the correct command?

#
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL:  role "root" does not exist```
#

from @craggy delta Your setup doesn't give the postgres the necessary env vars; the vars it expects start with POSTGRES_. The mapping in the default compose is there for a reason.

#

despite following these instructions, i still have the same issue

#

# The location where your uploaded files are stored
UPLOAD_LOCATION=/mnt/immich/immich-backup/library

# The location where your database files are stored. Network shares are not supported for the database
DB_DATA_LOCATION=./postgres

# 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

# 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=postgres

# PostgreSQL settings (use POSTGRES_ prefix)
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=immich

# The values below this line do not need to be changed
###################################################################################
DB_USERNAME=postgres
DB_DATABASE_NAME=immich```
hollow oyster
#

you probably want to run source .env first

#

so that the environment variable is taken into account in the session you are in

#

so that the command such as gunzip < "/mnt/immich/immich-backup/db-baclup/2LGZ4O~P.GZ" | docker exec -i immich_postgres psql --username=${DB_USERNAME} would fill in the DB_USERNAME as postgres

#

or you can fill them in directly from the command line

gaunt oasis
#

that worked!!!!

#

thank you!!!

#

how long does this process take normally?

hollow oyster
pine willow
# gaunt oasis ah how come?

Reliability and latency mostly. Databases (and postgres in particular) are not designed to live on network mounts of sorts

gaunt oasis
#

gunzip --stdout "/path/to/backup/dump.sql.gz" \

#

gunzip < "/mnt/immich/immich-backup/db-baclup/2LGZ4O~P.GZ" | docker exec -i immich_postgres psql --username=${DB_USERNAME}

this was what it was before?

cold pecan
#

It's changed slightly, there's no major difference

#

IIRC, < doesnt work on windows

gaunt oasis
#

alrighty. thank you!

#
  1. gunzip --stdout "/path/to/backup/dump.sql.gz" \

  2. | sed "s/SELECT pg_catalog.set_config('search_path', '', false);/SELECT pg_catalog.set_config('search_path', 'public, pg_catalog', true);/g" \

  3. | docker exec -i immich_postgres psql --dbname=postgres --username=<DB_USERNAME>

gaunt oasis
#

damn

#

i guess it didnt work

#

i followed all the steps 🙁

cold pecan
gaunt oasis
#

and it went through the entire restore process

#

i feel like i have all my file locations wrong

#

# The location where your uploaded files are stored
UPLOAD_LOCATION=./library

# The location where your database files are stored. Network shares are not supported for the database
DB_DATA_LOCATION=./postgres

# 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

# 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=postgres

# The values below this line do not need to be changed
###################################################################################
DB_USERNAME=postgres
DB_DATABASE_NAME=immich```
#

this is where the nfs share is mounted to

cold pecan
#

It’s NOT one by one mate

gaunt oasis
#

shit

cold pecan
#

The backslash should link the lines to each other. If it started doing stuff after the first command you messed up

gaunt oasis
#

gunzip --stdout "/mnt/immichqnap/backups/immich-db-backup-20251206T020000-v2.3.1-pg14.17.sql.gz" \

#

i ran this

cold pecan
#

Yes and what does it show

#

Show a screenshot of that first line entered

gaunt oasis
#

then i run the 2nd one

cold pecan
#

Ok now the next

gaunt oasis
#

| sed "s/SELECT pg_catalog.set_config('search_path', '', false);/SELECT pg_catalog.set_config('search_path', 'public, pg_catalog', true);/g" \

cold pecan
#

For the third why do you have db username? It should be Postgres per our docs

gaunt oasis
#

this one does the entire process as you saw in the screen shots in general

cold pecan
#

Oh username that’s correct

gaunt oasis
#

yes

cold pecan
#

What did you set it to

cold pecan
#

You need to set it from the env

gaunt oasis
#

just defaults

cold pecan
#

Usually anything in <> means a variable to need to put in

gaunt oasis
#

yea i downloaded the env, and did not touch it

#

o

gaunt oasis
cold pecan
#

Put whatever the db username , from the env, is set to, In that place

gaunt oasis
#
| 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=postgres```
#

liks this?

cold pecan
#

Yeah

gaunt oasis
#

fml

cold pecan
#

You might want to reset the database first

gaunt oasis
#

can you check my file pathways? tbh i think i screwed all that up

#

eea

#

yea

cold pecan
#

To make sure no crud is in there

gaunt oasis
#

i have to deleet it

#

yea

#

Note that for the database restore to proceed properly, it requires a completely fresh install (i.e. the Immich server has never run since creating the Docker containers). If the Immich app has run, Postgres conflicts may be encountered upon database restoration (relation already exists, violated foreign key constraints, multiple primary keys, etc.), in which case you need to delete the DB_DATA_LOCATION folder to reset the database.

cold pecan
#

No, your earlier screenshots had lots of DB info.

#

I think you don’t do the multi lines properly
Send a screenshot before you hit enter on the third line this time

gaunt oasis
#

well

gaunt oasis
#

sorry for all the questions

#

i can also delete this entire vm and start over if needed

#

no problem

gaunt oasis
cold pecan
#

Show it before you run it, the screenshot

gaunt oasis
#

i did

  1. docker compose down -v
  2. docker compose create
  3. docker start immich_postgres
  4. sleep 10
#

and now im here

cold pecan
#

That look good, send it

gaunt oasis
#

ok

#

thank you btw

#

its doing this

#

like it did the other day.

#

differrent from this morning

#

when i did this the other day, i did not include encoded-videos in my nfs share

#

so this time i did added everything

#

ok lets home immich app starts

#

last time it didnt

#

it usually doesnt take this long to start up right?

#

ohhhhhhhhh

#

woahhhhhhhh

cold pecan
#

Hmmm where’s the thumbs though , seems that mount is missing

gaunt oasis
#

yeaa

#

ima delete this entire vm

#

and start over

cold pecan
#

Looks like the DB worked fine, that may be overkill