I’ve read the thread. I’ve managed to move over the data over to a new custom volume under the new storage configuration. However the database is still sitting in the old /mnt/.ix-apps/app_mounts/immich/pgData
When editing the settings for the Postgres Data Storage option inn the immich docker in the web interface its grayed out editing where the database sits. It says ixVolume (dataset automatically created by system)
The pgvecto image is mounting
/mnt/.ix-apps/app_mounts/immich/pgData to /var/lib/postgresql/data
Ah ok, I think the issue is that TrueNAS does not currently support moving a storage path for an existing app from an ix-volume to a host path. I’d forgotten about this restriction. This isn’t strictly related to the Immich app change but a side-effect of you having previously used ix-volumes for prod storage.
You’ll need to redeploy Immich to move to host path volumes, but I suggest creating a new thread about migrating your data so others can hopefully assist with making sure as much as possible is retained and restored.
thanks that explains a lot. In that case should I just do a backup / restore to the new app instance I install? Is it an actual problem for the future and does it for sure need me to migrate where the database sits?
Finally got it working. I think it goes faster if you exclude the --progress flag from the rsync commands. Also, in my case, may be the same for others, in the old storage config it was “uploads”, in the new it is “upload”. Thank you!
This is THE single most infuriating thing I’ve ever had to do in my entire life. I would not wish this upon my worst enemy. Why the eff do I need to learn about datasets and ACL permissions and doing a chown on the postgress-data which needs to be a dataset within a dataset, but “data” needs to be a folder, and ixvolumes etc. etc. etc. ?!? The nightmares induced by this operation will last with me for a long time. This is the complete opposite of user-friendly and will cause 99.99999% of people to do a fresh re-install of IMMICH or give up on it altogether. Please THINK before you make users perform this operation. What will the “user experience” be? Will you alienate your audience? Can this be done in a better way? And finally for eff’s sake why is this not a GUI operation in the jobs area of IMMICH?
For those also struggling, maybe my experiences can help others.
-I don’t upload anything into IMMICH.
-I use IMMICH exclusively as a photo gallery.
-I tell IMMICH that my photos are in an external library on an SMB share on my HTPC.
-I used all the default options during the installation on TrueNas Scale.
-One of those default options means using ixvolumes and not a host path. (Why is because I figured defaults are there for a reason and couldn’t imagine the nightmare it could become.)
Before doing this, I ran TrueNas in a virtual machine, so I backed up the entire VM so I can restore it if I screwed up. If you don’t have this luxury, find out how you can back up and then restore your config before you screw up trying to follow my instructions.
Given the above here’s what I had to do:
Stop IMMICH (you don’t need to unset the pool under apps).
Go to SYSTEM> Shell.
Type: sudo -i
and then enter your admin password.
Type “zpool list”
You should see a list of ZFS pools on your system, you need to identify the one that will have your IMMICH data. For me I had two pools - one called “HTPC” and another called “boot”. Obviously “boot” isn’t the one I want so it was “HTPC” for me as it’s the name I gave TrueNas when I pooled my disks in the first place.
Next you’re going to list the datasets on the pool. Type in: “zfs list -r HTPC”
(replace “HTPC” with the name of YOUR pool)
You’ll see a breakdown of datasets. Look for the ones that have Immich in the name. For me I had Immich under “HTPC/ix-apps/app_mounts/Immich” and that had the mountpoint of “/mnt/.ix-apps/app_mounts/Immich”. Take a note of this, and better yet create a screenshot of the command from #5 above. Note that my mountpoint is .ix-apps - with a period. Pay attention to whatever your mountpoint is like.
Go to TrueNas>Datasets.
Identify a desired directory for Immich to “live” on. If you don’t have anything yet, under the root create a new dataset (preset = generic) and give it whatever name you like such as “Alex”. For me it was HTPC/Alex
Next you’re going to begin to create a dataset for Immich under HTPC/Alex - use the dataset preset=“apps”. Result will be HTPC/Alex/Immich. This needs to be a dataset and not a folder even though in Windows Explorer they both appear as folders.
The ACL permissions need to give the “netdata” user full control. (I also gave the “apps” user full control).
Create another dataset under Immich called “postgres-data”, also use the “apps” preset. (Note the single “s” and the dash and not underscore.) Give it the same ACL permissions as the Immich dataset. Result should be “HTPC/Alex/Immich/postgres-data”.
Create a “data” folder (NOT dataset) under Immich. Either do this from Windows Explorer (if you’ve set up SMB sharing) or run this from the Shell: mkdir -p /mnt/HTPC/Alex/immich/data/
Then, you’ll make more folders (not datasets) inside data: “backups”, “encoded-video”, “library”, “profile”, “thumbs”, and “upload”. Either use Windows Explorer or use the following to create these: mkdir -p /mnt/HTPC/Alex/immich/data/{backups,encoded-video,library,profile,thumbs,upload}
You will do the following commands one at a time from the shell (remember to do “sudo -i” if you get disconnected):
rsync -a --info=progress2 /mnt/.ix-apps/app_mounts/immich/backups/ /mnt/HTPC/Alex/Immich/data/backups/
rsync -a --info=progress2 /mnt/.ix-apps/app_mounts/immich/thumbs/ /mnt/HTPC/Alex/Immich/data/thumbs/
rsync -a --info=progress2 /mnt/.ix-apps/app_mounts/immich/library/ /mnt/HTPC/Alex/Immich/data/library/
rsync -a --info=progress2 /mnt/.ix-apps/app_mounts/immich/profile/ /mnt/HTPC/Alex/Immich/data/profile/
rsync -a --info=progress2 /mnt/.ix-apps/app_mounts/immich/uploads/ /mnt/HTPC/Alex/Immich/data/upload/
rsync -a --info=progress2 /mnt/.ix-apps/app_mounts/immich/video/ /mnt/HTPC/Alex/Immich/data/encoded-video/
rsync -a --info=progress2 /mnt/.ix-apps/app_mounts/immich/postgres_data/ /mnt/HTPC/Alex/Immich/postgres-data/
Given that I had 300+GB worth of data, this took a bit of time. The Shell does not time out for the current operation, but it will time out if no operation is running and it’s been ~3 minutes. If you’re not sure if the rsync has completed, simply re-run the command, it’ll verify the files are copied (happens very fast) and will resume if there’s anything that’s been missed. It’s safe to perform the rsync operation multiple times, you won’t create copies.
You need to change ownership of the Immich/postgres-data dataset you created earlier by running the following command: chown -R 999:997 /mnt/HTPC/Alex/Immich/postgres-data (again, replace “HTPC” with whatever YOUR pool name is and the rest of the directory path with wherever you created Immich in)
Under TrueNas>Apps>Immich>Edit - take a note of your Immich configuration as it is now - database/redis password, storage type (HDD/SSD), time zone, network configuration, “additional storage” configuration (I had SMB shares configured here), resource configuration. I took screenshots and saved on my computer.
Now you need to uninstall (delete) the Immich app. Simply un-checking the checkbox for “Use Old Storage Configuration (Deprecated)” won’t work because the postgres data storage is greyed out.
Begin installing Immich. (TrueNas>Apps>Discover Apps>Immich)
First two things you should do are:
Storage Configuration:
Data Storage (aka Upload Location): use “host path” and point it to the data folder under immich that you created. In my case that’s /mnt/HTPC/Alex/Immich/data
Second thing is Postgres Data Storage should be set to the Immich/postgress-data dataset you created earlier, in my case that’s /mnt/HTPC/Alex/Immich/postgres-data.
I’m going to assume you did a chown as per step #17 above. Now - configure the “User and Group Configuration” section of the Immich install screen to “user ID = 999” and “Group ID = 997”. This step is because you did a “chown” on the postgres-data dataset and this essentially makes the “netdata” user the owner of it and also now you’re telling Immich to use that user as part of its operations. I don’t have patience anymore to find out what is user 568 (default user that Immich is asking for during install).
Configure the rest of Immich with the settings you had noted as a part of step 18 above - postgres/redis passwords, additional storage, time zone, resource configuration, etc.
Finish the install. Cross your fingers and toes.
If this works, Immich is running - launch it to confirm all your stuff and settings are there. If not, ask Chat GPT - it’s what I had to use to figure all this out.
FYI I only went through this hell to save my computer from doing a month and a half of encoding at 100% CPU utilization (because VMWare Workstation does not allow neither my GTX 970 nor my i7-8700K’s iGPU to perform any GPU work on client machines despite “accelerate 3D graphics” being set). If it only took me less than a week to re-encode everything I would not be playing these “games”.
This is why I recommend not using TrueNAS’s “community apps” version of Immich (or anything else really), and just installing it with docker-compose, as recommended in the Immich documentation. These community apps always have huge “gotchas” and problems because it’s just another layer of indirection on top of docker-compose and the underlying app. I had a bunch of problems with other community apps, like random changes to storage locations in app updates, before I finally gave up on the whole mess and installed Dockge and then installed all my apps inside that with plain ol’ docker-compose. It’s been smooth sailing ever since.
Hi all! Before I migrate to new Storage Config, can you tell me please will it be possible to set new pgdata (postgres-data) location in separate dataset? Because my immich data located on HDD dataset, but I want to store pgdata (postgres-data) on another SSD dataset so that all indexes with more IO works faster?
And second question - can I just move data to new location instead of copying it? My data size is pretty large
Regarding the second question - in theory I imagine you could, but make sure you have backups and I would recommend copying the files as described above out of sheer fear of losing anything.
Also, make sure you have backups. And, if you don’t already have them setup, make sure there are backups.
I believe I had the same issue, for several of the subfolders. I kept thinking it was a permission issue but I couldn’t put my finger on it. Out of ideas, I tried going to the subfolder specified in the error message (/mnt/Main/immich/data/library in your case) using the TrueNAS shell, to then execute the command touch .immich. And it worked!
I don’t know if this is a bug, but it doesn’t seem like something I’d have to do. I still won’t entirely rule out that this is indeed a permission issue, but Immich has been running fine for me ever since I did that in all the affected subfolders.