First two are typical defaults, and the last one is fine for most normal use-cases.
That’s well under the limits set for inotify on your system, unless there are a lot of filesystem events for /data/scans
.
For example, an email server, web server or source code repo could overload the 16,384 events queue, even with a relatively small number of files.
Is there a backup program or something else besides Syncthing that’s running alongside the same user “syncthing” that’s also relying on inotify?
inotify’s user_watches
is per-user, so the total number of watches requested by Syncthing (across all Syncthing folders), plus any other programs that are requesting watches must be equal to or less than 121,770.
Yes, and it’s not just Syncthing, but also other programs that use inotify with a bindfs+FUSE filesystem. However, as with a lot of things in Linux – what was once unsupported can later (and often) become a regular feature.
To avoid having to update software settings every time the storage configuration changes, I use bind mounts to mask the real storage paths.
I’ve got a NAS running Fedora 38 (Linux 6.5.5 kernel + FUSE 2.9.9 + bindfs 1.17.4). For extra security, I also have SELinux enabled in enforcing mode.
Syncthing (similar to your setup), is running as syncthing:syncthing
. However, almost all of the subdirectories and files on the storage volumes are owned by my login (gadget:gadget
).
So to simplify management of storage and permissions, I use regular bind mounts and bindfs to selectively map storage paths to /srv
:
/srv
├── apps
├── backups
├── media
├── mirrors
├── Syncthing
└── users
For example, /srv/backups
is really a bind mount of /media/WD-1234567890/backups
(the mount directory WD-1234567890
is the serial number of my Western Digital HDD). If the drive needs to be replaced, I can update the bind mount without having to touch the backup software settings. I can also move the real backups
directory to a different drive without breaking user software settings.
As you can see above, I’ve got a /srv/Syncthing
directory. It’s a fuse.bindfs mount because the upstream directory it refers to is owned by root:root
. So Syncthing, as user syncthing:syncthing
, is writing to a directory with the following permissions:
drwxr-xr-x. 1 root root 26 Oct 7 14:09 Syncthing
The Syncthing folder above syncs with my Ubuntu 22.04 LTS laptop.
Syncthing on the NAS is set to watch for changes and do a full rescan every 3600 seconds. I’ve got 11,000+ files in 2,300+ subdirectories, and on average, new changes on the NAS start transferring to my laptop in roughly 11-12 seconds (well under the 3600 second rescan interval).
That’s certainly a viable option. gadget
on my NAS also belongs to the syncthing
group so that I can access files being managed by Syncthing.
I could have done my setup entirely with user and group permissions, but bindfs offered a way to not have to relabel files and directories (e.g. when I temporarily move an external drive to another system that doesn’t share the same UID:GID mappings).