If I mount --bind
/a
in /b
and if I mv /a/bigfile /b/
it will take a lot of time (if the source file is big). This will actually copy the file and then delete the source file instead of simply updating the filesystem's file table.
I understand how and why mount --bind
works. As pointed out by others, there are some good explanations on that:
- What is a bind mount?
- Why can't I create a 'hardlink' to a file from a 'mount --bind' directory on the same filesystem?
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 updating the filesystem's file table?
I'm asking how to solve this problem and not how 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.