mergerfs icon indicating copy to clipboard operation
mergerfs copied to clipboard

Plex and Jellyfin no Longer Detecting New Files with use_ino,func.getattr=newest

Open dannymichel opened this issue 3 years ago • 6 comments
trafficstars

i'm using use_ino,func.getattr=newest and whatever change in the new rclone or mergerfs versions made it so plex and jellyfin just don't detect changes anymore

rclone --version
rclone v1.58.1
- os/version: ubuntu 20.04 (64 bit)
- os/kernel: 5.4.0-109-generic (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.17.9
- go/linking: static
- go/tags: none
➜  ~ mergerfs --version
mergerfs version: 2.33.5
[Unit]
Description=merge
Requires=cloud.service
After=cloud.service

[Service]
Type=forking
ExecStart=/usr/bin/mergerfs /mnt/local:/mnt/cloud=NC /mnt/merge \
-o rw,use_ino,allow_other,func.getattr=newest,category.action=all,category.create=ff,cache.files=auto-full,statfs_ignore=nc,func.getattr=newest,dropcacheonclose=true,nonempty
KillMode=process
Restart=on-failure
User=user
Group=user

[Install]
WantedBy=multi-user.target
[Unit]
Description=cloud
After=network-online.target
Wants=network-online.target

[Service]
Type=notify
KillMode=none
Environment=RCLONE_CONFIG=/opt/rclone/rclone.conf
RestartSec=5
ExecStart=/usr/bin/rclone mount cloud: /mnt/cloud \
        --allow-other \
        --default-permissions \
        --uid 1000 \
        --gid 1000 \
        --dir-perms 777 \
        --file-perms 666 \
        --umask 002 \
        --log-file /opt/rclone/logs/rclone.log \
        --log-level INFO \
        --dir-cache-time 5000h \
        --drive-pacer-min-sleep 10ms \
        --drive-pacer-burst 200 \
        --poll-interval 30s \
        --rc \
        --user-agent rclone \
        --rc-addr 127.0.0.1:5572 \
        --cache-dir=/data/.cache/cloud \
        --drive-chunk-size 32M \
        --vfs-cache-mode full \
        --vfs-cache-max-size 350G \
        --vfs-cache-max-age 15m \
        --vfs-cache-poll-interval 5m \
        --vfs-read-ahead 2G \
        --vfs-read-chunk-size 32M \
        --vfs-read-chunk-size-limit off \
        --bwlimit 8650k:off \
        --transfers 3 \
        --bwlimit-file 20M
ExecStop=/bin/fusermount -uz /mnt/cloud
ExecStartPost=/usr/bin/rclone rc vfs/refresh recursive=true --rc-addr 127.0.0.1:5572 _async=true
Restart=on-failure
User=user
Group=user

dannymichel avatar May 08 '22 21:05 dannymichel

What do you mean by "detect change"? inotify? scanning?

Both should work fine and with inotify there is nothing that mergerfs does to support it. It is entirely outside its control.

inotify is trivial to test

In one shell inotifywait -m /mountpoint

in another

touch /mountpoint/test

trapexit avatar May 08 '22 22:05 trapexit

What do you mean by "detect change"? inotify? scanning?

Both should work fine and with inotify there is nothing that mergerfs does to support it. It is entirely outside its control.

inotify is trivial to test

In one shell inotifywait -m /mountpoint

in another

touch /mountpoint/test

in plex emby/jellyfin there is an option to monitor changes. when a new file is in /path/mergerfs/mount it picked it up and added it to plex/emby. it no longer does that. inotify i suppose.

inotifywait -m /mnt/merge
Setting up watches.
Watches established.

dannymichel avatar May 08 '22 23:05 dannymichel

➜  ~ inotifywait -m /mnt/merge   
Setting up watches.
Watches established.
/mnt/merge/ OPEN test.txt
/mnt/merge/ ATTRIB test.txt
/mnt/merge/ CLOSE_WRITE,CLOSE test.txt
/mnt/merge/ CREATE test1.txt
/mnt/merge/ OPEN test1.txt
/mnt/merge/ ATTRIB test1.txt
/mnt/merge/ CLOSE_WRITE,CLOSE test1.txt

dannymichel avatar May 08 '22 23:05 dannymichel

And all changes happen through mergerfs? Not out of band?

I'm on Ubuntu 20.04 with kernel 5.4.0-105 and current mergerfs... Works fine.

trapexit avatar May 08 '22 23:05 trapexit

➜  ~ inotifywait -m /mnt/merge   
Setting up watches.
Watches established.
/mnt/merge/ OPEN test.txt
/mnt/merge/ ATTRIB test.txt
/mnt/merge/ CLOSE_WRITE,CLOSE test.txt
/mnt/merge/ CREATE test1.txt
/mnt/merge/ OPEN test1.txt
/mnt/merge/ ATTRIB test1.txt
/mnt/merge/ CLOSE_WRITE,CLOSE test1.txt

This means inotify is working fine.

trapexit avatar May 08 '22 23:05 trapexit

You can get your current inotify file watch limit by executing: cat /proc/sys/fs/inotify/max_user_watches

If you are running Debian, RedHat, or another similar Linux distribution, run the following in a terminal:

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.d/40-max-user-watches.conf && sudo sysctl -p

If you are running ArchLinux, run the following command instead:

echo fs.inotify.max_user_watches=524288 | sudo tee /etc/sysctl.d/40-max-user-watches.conf && sudo sysctl --system

Then reboot. This needs to be done on the host, not the container. See here for more information.

You're probably out of watches.

michaelkrieger avatar Aug 02 '22 18:08 michaelkrieger

Sorry, I know this is closed, but I'm having a similar issue.

My setup is rclone read-only -> mergerfs -> jellyfin.

When another server adds a file to rclone, no inotify event is triggered on this one via mergerfs.

Am I right to expect it to fire in this case?

If I list the contents of the directory via the mergerfs mounted directory, the new file is immediately visible, however.

ndom91 avatar Mar 24 '23 22:03 ndom91

Am I right to expect it to fire in this case?

No. If you write a file out of band to mergerfs there is no way for mergerfs or the kernel to have any idea it occurred.

trapexit avatar Mar 24 '23 22:03 trapexit