I am sure this may seem like a simple question, but I cannot seem to ask Google the correct question for the life of me. In short, I am having trouble understanding how symbolic links function when a given filesystem is mounted at multiple points.
I have been following the FreeBSD Handbook in setting up application jails on my little home server. Everything has been going along smoothly, until I encountered the second to last step in setting up the master template. More specifically, when I am to issue the following commands:
# cd /home/j/mroot # mkdir s # ln -s s/etc etc # ln -s s/home home # ln -s s/root root # ln -s ../s/usr-local usr/local # ln -s ../s/usr-X11R6 usr/X11R6 # ln -s ../../s/distfiles usr/ports/distfiles # ln -s s/tmp tmp # ln -s s/var var
Now, these commands will execute just fine. What I am concerned with is the why. I know that the master template will be mounted as read-only so mounting one file set for multiple jails is no problem. My confusion is how the operating system knows which service's data directory (/s directory, mounted read-write for each service) to use given that the master template only maintains one set of links? Say I had two services, www and ftp. Each will use the master template at /home/j/mroot (mounted read-only at /home/j/) and have their own data directories (found at /home/js/; mounted read-write at /home/j/). Based on the links, how is the filesystem able to know that it should write to the www data directory within one jail and to the ftp data directory from another?
Also, why are the "../" pathing operators required from some of the links? It is my understanding that those would back you right out of the current directory and to elsewhere in the filesystem, whish is likely an invalid path?
I apologize if these are simple questions. My searching has not turned up anything, but I certainly suspect that I may be simply asking the wrong questions. For reference, here is the link to the particular FreeBSD handbook page.
Thank you in advance for your assistance.