Database Restoration on TrueNAS
I tried to migrate my existing setup from an HDD to an SSD and everything is verbatim the same. Unfortunately on Immich you need to also do a manual restoration of the database as I can't really see any users while still having all of the data on the datasets. I did read the restoration guide on the website but I don't think it's possible for me to implement this on TrueNAS apps.
61 Replies
:wave: Hey @AZA?ZAA?zur,
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
- Container Logs:
docker compose logs docs
- Container Status: docker ps -a docs
- Reverse Proxy: https://immich.app/docs/administration/reverse-proxy
- Code Formatting https://support.discord.com/hc/en-us/articles/210298617-Markdown-Text-101-Chat-Formatting-Bold-Italic-Underline#h_01GY0DAKGXDEHE263BCAYEGFJA
Checklist
I have...
1. :ballot_box_with_check: verified I'm on the latest release(note that mobile app releases may take some time).
2. :ballot_box_with_check: read applicable release notes.
3. :ballot_box_with_check: reviewed the FAQs for known issues.
4. :ballot_box_with_check: reviewed Github for known issues.
5. :ballot_box_with_check: tried accessing Immich via local ip (without a custom reverse proxy).
6. :ballot_box_with_check: uploaded the relevant information (see below).
7. :ballot_box_with_check: 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.I don't think most of the information wanted on this checklist matters as I use TrueNAS apps for downloading and using Immich. If it helps I applied the exact same settings as my previous HDD setup. I'm pretty sure the issue is with the database restoration (which i can not do (at least i think so))
Successfully submitted, a tag has been added to inform contributors. :white_check_mark:
I am talking about this bit here: https://docs.immich.app/administration/backup-and-restore#manual-backup-and-restore I do have the automatic database backup available but I can't seem to restore it without using docker-compose, am I correct in my thinking?
So you created both datasets on the SSD and copied everything over? Or you did it using zfs replication?
Can you show the old and new datasets as well as the immich config
It is possible to restore with the backup (tip section) but I don't think that would be that necessary.
It would be the safest to do, but I just need/want to undersdand your setup first.
Also why did you move everything to an SSD? It's not required to move everything to there to have Immich perfom "good"
Unfortunately because of my setup I couldn't do a zfs replication. I just used an SFTP connection to download everything to my actual computer and when I installed the SSD resent everything. I checked the data integrity so I am 99% sure that's not the case. The reason why I moved everything to an SSD is because one of my HDD's failed so I took this as an opportunity to move mission critical data to a MIRRORed SSD setup so that my remaining single HDD could be used for Jellyfin/media storage (which is not mission critical data)
sending over the datasets, one second
inside data obviously there are the required files needed for immich to function as stated on the guide. this was exactly the same before

I deleted the pgdata contents because the app would refuse to start unless it created its own
i still have a backup of them on my computer of course
here is my immich configuration on truenas apps (if that can be of any help)


Yes, I’ll have a look at it in 5 minutes
thank you very much 🙏 im in no rush
Why do you have Immich user and group set to 0 (which is root)
I honestly have no idea, I just replicated the previous settings which was 0 instead of 568
previously it worked fine
Oh make sense, well it's just a bit more secure to not run apps as root (from what I've read) so if you want this can also be changed to be 568, which is the uuid of the "apps" user and group TrueNAS uses
in the data dataset, do you have a "backup" folder?
yes, there is a backups folder
let me send the entire structure

Oh alright, I'll keep that in mind! But I don't think this will fix my situation (?) i'll try it anyway
No, well we can do both at the same time
can you show the content of it?

Ok nice, so there is a backup from yesterday that can be restored
yeah that's what i noticed, but couldn't restore it using the guide because it requires docker compose (i think)
It doesn't necesseraly, there is a another way explained in the tip section of the backup and restore, so:
1) Stop the Immich app
2) remove the content inside the pgData dataset
3) Edit the Immich app and add an environment variable
Name is:
DB_SKIP_MIGRATIONS
Value is: true
Then you save the config (click on update) and start Immich
hmmmm, i can't seem to even install immich as an app if the pgdata is filled with the old folders. can i just install it with this environmental variable without the pgdata data?
Does it throws an error?
yes. it throws an error if i try to install it with the old pgdata folders
i can only start it with a fresh pgdata dataset
which it fills by itself
Is this pgData empty now?
If so point immich to it with the added variable this will avoid any migration/setup so Immich won't fill it up
(it is somehat similar as only starting the database in the compsoe method)
okay yeah started it with the enviroment variable while pointing it to an empty pgdata dataset
and it seems that it DID fill the dataset
Yeah maybe initial stuff
We'll see with the "restore" command if that works
If not it means that something was done incorrectly
immich is running right now but giving out errors which i am assuming is because of a lack of postgresql db
So now, in TrueNAS shell do (and modify FULL_NAME_OF_LATEST_BACKUP_GZ with the name of the latest backup in the backups folder):
then
i did try this before but forgot to change the name to ix-immich-pgvecto-1
let me try!
yeah, with trueNAS it's a bit different
And without the variable it wouldn't have worked anyway as Immich would have started
i actually did try it with the variable! i just thought it didnt work because it did fill it with folders
i think that worked?

Yep
Now, you can edit immich again, and remove the variable
then update/save (and it should restart the app) otherwise restart it
yeah tell me about it, it gives me a headache every single time i try to use cli for docker
Well if you need the docker container names you can just list them
yeah i can see them on portainer as well (you can also guess the names as theyre predictable) but theyre such a pain in the ass to type
hmmm the server container gives out this error and restarts itself, which i am assuming is a permissions issue

How often do you need to use that though? I rarely use the cli on my TrueNAS setup
Btw Does immich work now?
eh not that frequently but its still a pain in the ass when i need to use it
Either be perms, or it's possible that hidden files weren't moved
Can you show the permissions on the "data" dataset?
ooooh yeah that could also be the case
let me check
I can give you the "default" apps ACL so you could switch immich from 0 0 to 568 568
okay turns out the automatic permission didn't work and it was stuck on root
trying it with 568 as we speak
No
Automatic permissions in only on the pgData dataset

On the data, you could set this as an acl
man that worked!
i can access immich now!!!!!
this way apps and root will have access (root is for "you") while the "apps" is for Immich
thank god
thank you so much 🙏
can i be of assistance in any way to this community to repay (dont really have much code knowledge though, just experience with trial and error 😄 )
No problem!
Well you can always try to help other, report bug/issues (on GitHub)
If you think about any feature that could make Immich (in your opinion), and that no one already talked about here: https://github.com/immich-app/immich/discussions you can suggest an idea (or upvote tohers)
well yeah actually the location feature doesn't seem to work quite right. it always names the district that is the most proximal to the actual district the photo was taken (so if a photo was taken in district a and district a is close to district b immich will say that that picture was taken in district b no matter what. let me see if anyone else has had this issue
maybe its a regional thing but this always seems to be the case no matter where i am
It's already been reported
well "reported" it's an expected behaviour the way Immich manages location
hmmm interesting
reverse geocoding*
well ill think of something else then!
again, thank you so much for your help 🙏
https://discord.com/channels/979116623879368755/1430467960644046938
If you want to read another small thread about it
No proble!
you can /close the ticket
alright!
This thread has been closed. To re-open, use the button below.