Mount –bind in the same filesystem move files as in the same filesystem

bind-mountmountsymlink

If I mount --bind /a in /b and if I mv /a/bigfile /b/ it will take a lot of type (if the origin file is big). This will actually copy the file and then delete from the origin instead of simple update the filesystem's file table.

I understand how and why mount --bind works. As pointed out by others, there are some good explanation on that:

Is there any way of telling mount that a mount --bind is in the same filesystem so that operations like this (move) are done by actually update the filesystem's file table?

I'm asking for solving this problem and not to understand it: maybe a kernel patch already available that I'm not aware of it or a missing parameter I didn't find already (etc).

Why: In my current setup there is a service (nextcloud) that only supports the mount --bind. I can't use symlinks. If I need to, say, have a shared folder inside each account of nextcloud it must be with bind. I may accept any solution that works with nextcloud if it is made in the filesystem/kernel level. This is because the current setup also includes access to these files in other ways, like ssh. In other words, I would like be able to move a file as in example using any command or application.

Best Answer

Apparently not, the man page rename(2) mentions this:

EXDEV oldpath and newpath are not on the same mounted filesystem. (Linux permits a filesystem to be mounted at multiple points, but rename() does not work across different mount points, even if the same filesystem is mounted on both.

If I recall correctly, a bind mount is the same as just mounting the same filesystem multiple times, i.e. there's no "source" and "target" for the bind after the fact.

There's also another answer to another question on the same subject from a couple of months ago. That one has pointers to a discussion about it with the kernel developers. So go upvote that.