linuxserver / docker-jellyfin

GNU General Public License v3.0
607 stars 91 forks source link

Skip chown on files already owned by correct UID/GID #169

Closed DavidFair closed 1 year ago

DavidFair commented 1 year ago

linuxserver.io

When the container starts chown should only run over the files in /config that don't have matching UID/GIDs


Desired Behavior

On startup the container should use find to filter through all the directories to find files and directories which do not have the correct user and group set. It should then use the exec flag to set ownership on these specific files and directories.

Doing a quick search I think something similar to this SO answer could work. But I haven't tested it.

Current Behavior

Currently we change ownership of all files regardless of ownership. On COW systems (such as ZFS) where snapshots (for backups) exist this incurs a significant startup penalty on HDDs and unnecessary writes on SSDs as it triggers copy creation.

Startup time quickly becomes proportional to library/config size as metadata (such as thumbnails) get stored into /config by default too.

Alternatives Considered

Note: this is unrelated to #62 (and the subsequent discussion). From a user POV the observable effects should be the same.

I'm happy to prototype / throw up a PR with the required changed, but I'd like to get the go-ahead before committing time to this.

github-actions[bot] commented 1 year ago

Thanks for opening your first issue here! Be sure to follow the bug or feature issue templates!

kaysond commented 1 year ago

+1. This is really how it should be done across all containers. @DavidFair you may want to post in the devs channel on discord