After removing a bay mounted SATA connected drive the kernel will most of the time remove the mount. However, sometimes the mount remains even though the disk has been removed. Is there a way to avoid this?
As I ended replied to the original OP, you can always force an unmount with a lazy unmount
umount -l <filesystem|partition>
Nevertheless the thing about lazy umount is that it ignores the pending buffers to be written to that drive.
I would recommend a script a sudo for the user or a group of users that run the app, that only allows to run a script to umount the drive, and that can be invoked by the app. Or even a key on the console programmed to to call a script. (if a physical server)
I would not remove the actual drive without unmounting manually the mount point previously.
There are not guarantees the cache will be flushed or even data corruption can ensue otherwise.
One thing is hot mounting something, like a USB disk or a drive, a whole different story is unmounting it.
I'm a person that just registered here for asking exactly the same question and ran in to this while looking for the appropriate categories...:)
It could be so that, since you're writing to a fuse filesystem, and fuse is "filesystem in userespace", there's actually a separate user process running as long as the mount exists. This is just a theory, but I suspect that if this process dies or perhaps hangs, the state of the mount might not be updated properly, even if the disk has been detached.
In any case, it would be easy to test if this behaviour is reproducible by sending
SIGKILL to one of these processes.