r/immich • Support Crew • 4d ago

A tale of caution when using storage templates.

Im sure a bunch of folks are using storage templates but there could be a hidden nightmare.

In my case I take 321 backups to the nth degree so Im likely a bit of an edge use case but wanted to warn anyone who may run into the same issues that I have.

My backup strategy is a nightly restic backup to pcloud, backblaze, an external USB drive, and two seafile servers as well as a backup script being run from the user systemd services that looks for any changes in the upload folder of immich and sync's those changes to the USB drive and the two seafile servers.

The idea is to have multiple true backups with multiple carbon copies of the raw data. With the raw data in seafile I can very easily keep file changes documented since seafile has a nice web interface and keeps version history of the data should I need to restore a single deleted photo or video. The USB drive is just in case I die tomorrow my wife can simply take the USB drive, plug it into another computer and have easy access to all our photos.

My storage template should have looked something like this. {{y}}/{{filetypefull}}/{{filename}} resulting in the file directory structure UPLOAD_LOCATION/library/admin/2022/IMAGE/IMAGE_56437.jpg

However when I initially set up storage templates there was a space between the folder name and the file name so it actually looked like this. {{y}}/{{filetypefull}} /{{filename}} which ends up looking something like this UPLOAD_LOCATION/library/admin/2022/IMAGE /IMAGE_56437.jpg

In my original configuration there was a space being added between "image /filename" or "video /filename"

Under normal file and restic backup operations it didnt seem to make much difference. Restic backups didnt care about that extra space at all.

My rclone sync job ran into issues though.

The sync job to the USB drive went fine as ext4 doesnt seem to care about that space or ignores the extra space but the seafile servers took extra issue with that config as the sync job was adding an extra byte of data to the synchronized files and causing errors.

For most this maybe a non issue but I felt maybe there could be someone who have made the same mistake that I did.

27 Upvotes

4 comments sorted by

1

u/ferrybig 4d ago

the seafile servers took extra issue with that config as the sync job was adding an extra byte of data to the synchronized files and causing errors.

Looking at their repo, it seems problems with characters that need url encoding are common, typically caused by proxy servers in the path and being closed for no repro (WebDAV is not compatible with HTTP URL semantics, reverse proxies follow http URL semantics, mangling WebDAV file names)

1

u/thehatefuleggplant Support Crew 4d ago

Yeah I was finding the same info.

Their webdav is a little lack luster as I cant do hash checks while doing this

1

u/IcarusOnl 2d ago

A quick way to isolate this is to copy two throwaway files through the exact route you use for backups: one with a normal path and one with the trailing-space directory. Download both from Seafile and compare their local checksums with the originals. That separates a filename or path handling problem from any change to the file bytes, even if the remote can’t report hashes.