Linux – How to do a bind mount over a symlink

linuxmountsymlink

I have a symlink:

/test

Which is pointing at a directory:

/source

I want to do a bind mount to mount /new over /test

mount -o bind /new /test

However this binds /new over /source (with /test pointing at /source – showing the files from /new, but not what I want). How do I stop mount following the symlink and get it to mount at /test.

Best Answer

Since /test is not a real directory, this won't work.
Unlink it, create it as a real directory, then do the bind mount.