Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

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

share|improve this answer
    
You can use bind mounts to replace one file with another, but it appears that when the target is a symlink, the kernel expands it before doing the bind mount :( –  Cheetah Sep 24 at 23:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.