I
Immich5mo ago
Maraxen

Using SMB share to save photos and DB

Hi guys, I'm trying to have my Immich instance to upload the photos and DB to SMB share. I'm using Proxmox and then running Immich on Debian VM. I'm also running TrueNAS Scale in another VM. So I made a dataset and made a SMB share out of it. You can see the ACL in the uploaded screenshot. Then I went and mounted the share using this command:

sudo mount -t cifs //192.168.2.15/immich /mnt/immich -o username=immich,password=mypassword

sudo mount -t cifs //192.168.2.15/immich /mnt/immich -o username=immich,password=mypassword
After that I edited the .env file
# You can find documentation for all the supported env variables at https://immich.app/docs/install/environment-variables

# The location where your uploaded files are stored
UPLOAD_LOCATION=/mnt/immich/library
# The location where your database files are stored
DB_DATA_LOCATION=/mnt/immich/postrgres

# 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 "v1.71.0"
IMMICH_VERSION=release

# 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
# You can find documentation for all the supported env variables at https://immich.app/docs/install/environment-variables

# The location where your uploaded files are stored
UPLOAD_LOCATION=/mnt/immich/library
# The location where your database files are stored
DB_DATA_LOCATION=/mnt/immich/postrgres

# 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 "v1.71.0"
IMMICH_VERSION=release

# 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
When I run
docker compose up
docker compose up
I can see many errors one of them being:
chown: changing ownership of '/var/lib/postgresql/data': operation not permitted
chown: changing ownership of '/var/lib/postgresql/data': operation not permitted
No description
No description
30 Replies
Immich
Immich5mo ago
:wave: Hey @Maraxen, 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.
Daniel
Daniel5mo ago
DB on an SMB share is a very bad idea
Immich
Immich5mo ago
Successfully submitted, a tag has been added to inform contributors. :white_check_mark:
CrushedAsian255
CrushedAsian2555mo ago
Run the database locally Please Images and videos can be on SMB
Maraxen
MaraxenOP5mo ago
Why is that? I thought that it would be better because my server is sadly short on resources so I have all VMs on a small 128GB SSD and I thought that it would be better to have all my important stuff on RAID Z1 pool
CrushedAsian255
CrushedAsian2555mo ago
Databases really don’t like network shares If you want the security then store the database backups on SMB
Maraxen
MaraxenOP5mo ago
Yeah, I tried having the DB locally and the images and videos on the SMB and it worked fine
CrushedAsian255
CrushedAsian2555mo ago
It that works fine then keep that configuration Database shouldn’t be more than a gigabyte or so Unless you have an extreme amount of assets
Daniel
Daniel5mo ago
FWIW having your DB on a RAID/Z1 pool doesn't make it more resilient anyways given a copy of a postgres folder is pretty much useless
Maraxen
MaraxenOP5mo ago
Oh, alright, I'm not trying to be picky on you but is there a more specific reason on why DBs don't like being on network shares? I totally trust you but as a tech enthusiast I want to learn as much as I can 😄
CrushedAsian255
CrushedAsian2555mo ago
Data integrity for databases is significantly different to data integrity for just random files
Maraxen
MaraxenOP5mo ago
Oh alright, will rsync do the job then?
Daniel
Daniel5mo ago
Latency, permissions, reliability
CrushedAsian255
CrushedAsian2555mo ago
They rely on fancy things like locks and permissions and seeking and also need high performance access Most network shares don’t support that
Daniel
Daniel5mo ago
FWIW you could probably make it work with SMB. But you really shouldn't
Maraxen
MaraxenOP5mo ago
ohhh alirght, thank you for the info!
CrushedAsian255
CrushedAsian2555mo ago
You can also get to work by moonwalking there while juggling chicken eggs but why would you
Daniel
Daniel5mo ago
Oh come on that comparison isn't fair. That would be super cool! I do that at least once a year
Maraxen
MaraxenOP5mo ago
I made it work with NFS but I had to configure mapall setting to root and it seemed like a very bad idea to me. Also the other thing that I didn't like about the SMB apporach is that, if I understand it right, there's no built in form of authentiaction
Daniel
Daniel5mo ago
Yeah it's always just a really bad idea tbh
CrushedAsian255
CrushedAsian2555mo ago
And also even if you get it working, performance will be horrendous
Daniel
Daniel5mo ago
If you have block storage and a share over that (e.g. Ceph) you can (more reasonably) make it work But it's almost never a good idea
Maraxen
MaraxenOP5mo ago
But I will totally follow ur advice and keep the DB locally. Also what would happen if the disk with DB dies? Would it be easy to restore Immich and upload all the photos back?
Daniel
Daniel5mo ago
No, that's why you need to make backups of your DB
CrushedAsian255
CrushedAsian2555mo ago
Block storage? Minecraft chests? Or do you mean like iSCSI
Daniel
Daniel5mo ago
The latter lmao Although that joke is actually quite good haha
Maraxen
MaraxenOP5mo ago
ohhhh alright I thought about that but it seemed like a lot of trouble so I'm glad that I shouldn't do that xd alirght I will make sure to do that also I noticed that even if I changed DB to local it still has some kind of the problem with the SMB share for the images
Maraxen
MaraxenOP5mo ago
No description
CrushedAsian255
CrushedAsian2555mo ago
It’s complaining it can’t find a special marker file If you haven’t uploaded anything yet you can delete the database directory and start again
Maraxen
MaraxenOP5mo ago
alrighty I will try that everything seems to work fine now thank you for the help guys!

Did you find this page helpful?