#folders to save as backups

1 messages · Page 1 of 1 (latest)

wary charm
#

I want to test the backup and restore procedure, I already have the database backup that immich generates every night, now what other folders do I need to copy apart from the library, so that when I restore everything it works as before?

wild geyserBOT
#

:wave: Hey @wary charm,

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

References

Checklist

  1. :blue_square: I have verified I'm on the latest release(note that mobile app releases may take some time).
  2. :blue_square: I have read applicable release notes.
  3. :blue_square: I have reviewed the FAQs for known issues.
  4. :blue_square: I have reviewed Github for known issues.
  5. :blue_square: I have tried accessing Immich via local ip (without a custom reverse proxy).
  6. :blue_square: I have uploaded the relevant logs, docker compose, and .env files, making sure to use code formatting.
  7. :blue_square: I have 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)

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

wary charm
#

Thank you, I have already read it, but what is not clear to me is if I don't make copies of the "profile" folders, for example, do I lose the users I have? Or is it created again with the data that is in the database?

astral vault
wary charm
#

Thank you, so I just copy the library folder, and the others are generated again when restoring?

astral vault
full spoke
#

Why don’t you just copy the ones the docs say?
The only ones you should skip are encoded video and thumbs

#

The other ones do not get re generated so you should back them all up (library, profile, upload, backups)

wary charm
#

Thank you both, I will do that, I run tests on a virtual PC before proceeding with the original, I just want to be sure that the copy will work if I have to restore, as it's already at 45 GB and I don't want to upload everything again, it happened to me once before.

wary charm
#

When I run this command, it gives me an error.
sudo gunzip < "/home/santiago/immich-db-backup-1731502380008.sql.gz" | 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 --username=postgres
permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.46/containers/immich_postgres/json": dial unix /var/run/docker.sock: connect: permission denied

full spoke
#

You’re not running it as sudo

#

Each command needs a sudo if you’re not at a root shell

wary charm
#

The database was restored successfully, but immich_server won't start, it gives these errors.

#

[Nest] 7 - 11/13/2024, 2:57:03 PM LOG [Microservices:StorageService] Verifying system mount folder checks, current state: {"mountChecks":{"thumbs":true,"upload":true,"backups":true,"library":true,"profile":true,"encoded-video":true}} [Nest] 7 - 11/13/2024, 2:57:03 PM ERROR [Microservices:StorageService] Failed to read upload/encoded-video/.immich: Error: ENOENT: no such file or directory, open 'upload/encoded-video/.immich' microservices worker error: Error: Failed to read "<UPLOAD_LOCATION>/encoded-video/.immich - Please see https://immich.app/docs/administration/system-integrity#folder-checks for more information." microservices worker exited with code 1 Killing api process

full spoke
#

If you didn’t restore those folders like encoded video you need to make the .immich file in them

wary charm
#

Seeing that they weren't created when the services started, I created them manually. I only copied and restored the library and profile folders, but after restarting, everything still gives the error.

#

Initializing Immich v1.120.2 Detected CPU Cores: 2 Starting api worker Starting microservices worker (node:6) [DEP0060] DeprecationWarning: Theutil._extendAPI is deprecated. Please use Object.assign() instead. (Usenode --trace-deprecation ...to show where the warning was created) (node:16) [DEP0060] DeprecationWarning: Theutil._extendAPI is deprecated. Please use Object.assign() instead. (Usenode --trace-deprecation ...to show where the warning was created) (node:6) [DEP0060] DeprecationWarning: Theutil._extendAPI is deprecated. Please use Object.assign() instead. (Usenode --trace-deprecation ... to show where the warning was created) [Nest] 6 - 11/13/2024, 3:29:18 PM LOG [Microservices:EventRepository] Initialized websocket server [Nest] 6 - 11/13/2024, 3:29:18 PM LOG [Microservices:MetadataService] Bootstrapping metadata service [Nest] 6 - 11/13/2024, 3:29:18 PM LOG [Microservices:MetadataService] Initializing metadata service [Nest] 6 - 11/13/2024, 3:29:18 PM LOG [Microservices:MapRepository] Initializing metadata repository [Nest] 6 - 11/13/2024, 3:29:18 PM LOG [Microservices:MetadataService] Initialized local reverse geocoder [Nest] 6 - 11/13/2024, 3:29:18 PM LOG [Microservices:ServerService] Feature Flags: { "smartSearch": true, "facialRecognition": true, "duplicateDetection": true, "map": true, "reverseGeocoding": true, "importFaces": false, "sidecar": true, "search": true, "trash": true, "oauth": false, "oauthAutoLaunch": false, "passwordLogin": true, "configFile": false, "email": false }

#

[Nest] 6 - 11/13/2024, 3:29:18 PM LOG [Microservices:StorageService] Verifying system mount folder checks, current state: {"mountChecks":{"thumbs":true,"upload":true,"backups":true,"library":true,"profile":true,"encoded-video":true}} [Nest] 6 - 11/13/2024, 3:29:18 PM ERROR [Microservices:StorageService] Failed to read upload/encoded-video/.immich: Error: ENOENT: no such file or directory, open 'upload/encoded-video/.immich' microservices worker error: Error: Failed to read "<UPLOAD_LOCATION>/encoded-video/.immich - Please see https://immich.app/docs/administration/system-integrity#folder-checks for more information." microservices worker exited with code 1 Killing api process

#

thus it keeps repeating

wary charm
#

Well, I'll tell you that I already managed to successfully restore my data.
In my configuration I have: UPLOAD_LOCATION=/home/santiago/immich and DB_DATA_LOCATION=/home/santiago/immich/postgresql/data
I manually create the previous folders. Once the server is started, it creates the other folders (Backups, encoded-video, library, profiles, thumbs, and upload) in the immich folder.
After setting up the service, creating users, and uploading photos and videos for the 2 users I created, I scheduled the backup to make a backup copy for me.
Then I stopped the 4 services with which immich operates, and elsewhere I created another structure for my backup. I created a folder called immich1, inside I created the same folders (Backups, encoded-video, library, profiles, thumbs, and upload) and copied into each one a hidden file inside called: .immich. This file is not the same in each folder, so I had to go one by one. I copied the library folder completely, as it contained my original data.
I then ran the command chown -R root:root postgresql, to be able to delete the database that is inside the data folder and then inside the immich folder rm -r *, deleting all the folders. With the immich folder clean, I started creating the folders again (Backups, encoded-video, library, profiles, thumbs, and upload) and inside these I placed the corresponding .immich file from the backup I had made earlier. I created the postgresql/data folders to store the postgresql data there.
Then I just followed the instructions on the immich page.

#

`docker compose down -v # CAUTION! Deletes all Immich data to start from scratch

Uncomment the next line and replace DB_DATA_LOCATION with your Postgres path to permanently reset the Postgres database

rm -rf DB_DATA_LOCATION # CAUTION! Deletes all Immich data to start from scratch

docker compose pull # Update to latest version of Immich (if desired)
docker compose create # Create Docker containers for Immich apps without running them
docker start immich_postgres # Start Postgres server
sleep 10 # Wait for Postgres server to start up

Check the database user if you deviated from the default

gunzip < "/path/to/backup/dump.sql.gz"
| 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 --username=postgres # Restore Backup
docker compose up -d # Start remainder of Immich apps`