trapexit / mergerfs

a featureful union filesystem
http://spawn.link
Other
4.24k stars 173 forks source link

Report invalid branches #1360

Open sprat opened 2 weeks ago

sprat commented 2 weeks ago

Is your feature request related to a problem? Please describe.

I had a hard time troubleshooting a problem that was due to a mistake from me where I had no valid branch in my mergerfs call:

$ mkdir /mnt/storage
$ mergerfs /nonexistent1:/nonexistent2 /mnt/storage
mergerfs[9]: threadpool (fuse.read): spawning 8 threads w/ max queue depth 8
mergerfs[9]: running basic garbage collection
$ mergerfs[9]: read-thread-count=8; process-thread-count=-1; process-thread-queue-depth=-1; pin-threads=false;

$ ls /mnt/
ls: /mnt/storage: No such file or directory
$ mkdir /mnt/storage
mkdir: can't create directory '/mnt/storage': File exists

Note that it's easy to get into this situation when we use wildcard in branches (/media/data* in my case) but nothing matches the wildcard expression

Describe the solution you'd like

Ideally, I would like to get an error message (or a warning at least!) when I call the mount command with invalid branches directories.

Describe alternatives you've considered

None

Additional context

mergerfs v2.40.2

trapexit commented 2 weeks ago

No branches is technically not invalid but I can add a warning.

sprat commented 2 weeks ago

Yes, I understand that it may be a use case to have nonexistent directories at first, and have those directories created and mounted after mergerfs is started, that's why I suggested a warning at least ;)

sprat commented 2 weeks ago

I would say: