Is bind mount possible in FreeBSD

I'm used to Linux, so evidently my syntax is not working here.

mount --rbind /media/folder /home/myuser/folder

results in
mount: illegal option -- -

also tried mount --bind
also tried mount -B
--> same error

Moreover, I'd like to do this in fstab, but
/media/folder /home/myuser/folder none bind 0 0

results in a non-fatal boot error.

This is FreeBSD 12.1 as guest in VirtualBox VM in Debian. Guest additions installed.

Any suggestions?
 
Well, this is why the manualpage exists, check mount(8) if you need to verify the used syntax.

As to bind... why assume that we know how things work in Linux? ;) I haven't used Linux in quite a while and therefor have no idea what you're talking about here. I'm guessing you're trying to "mount" a regular folder on top of another (eeew), but for that I'd suggest using a symlink, see ln(1).

(edit)

Did a quick check on Bing and my assumption is correct. Needless to say that I'm not a fan of this because I can't help be convinced that this is going to cause quite some clutter. IMO this is keeping a sloppy administration.

Having that out of the way, it seems to evolve around a virtual filesystem called bindfs. And if you want to use arcane filesystems on FreeBSD then FUSE is a good starting point. And what do you know... you probably want to check out sysutils/fusefs-bindfs. Though I'd still suggest using ln instead, but that's just me ;)
 
Ok, thanks for the answer, I assumed the bind flag was available in mount, but I now see that it's not and that fusefs-bindfs must be installed to accomplish this.

In this case I'm mounting an external device (actually a share which is treated as such) to /media/folder and then binding /media/folder to a user directory. I've never thought of this confiugration as being eeew or even all that uncommon. Mounting a drive onto a folder is conceptually the same in my mind.
 
There are good reasons that bind mount (and union mount and null fs mount and ...) exist. You can use them for good and for evil. They are not necessarily "eeew".
 
There are good reasons that bind mount (and union mount and null fs mount and ...) exist. You can use them for good and for evil. They are not necessarily "eeew".
Not my intend to start a whole discussion but.. I never questioned the method, only the way it's being used. nullfs can be extremely useful within jails for example. But as soon as we're looking at accessing the same data from different locations then I cannot help but wonder about flakey administration. Generally speaking I'm then inclined to think "eeew".
 
In a perfect world, where everything can be planned ahead of time, and there are no conflicting requirements, you might be right. But the real world isn't so neat. You might have a few users who want their home directory at /home/<username>, but the bulk of your users has it at /usr/home/<username>. Not just "want", but they have thousands of lines of scripts that are hard to change. Sure, that can be fixed with soft links, but bind mounts are industrial strength soft links without some of the pitfalls (cd works, you get unique dev/inode numbers), but with some new pitfalls added. Or you can add bind mounts to change uid/gid on the fly, if the same user needs to be known by different IDs on the same system.

Many of the same tricks can be done by NFS exporting the file system to yourself, and mounting it. That's probably even more eeew.
 
Back
Top