NFS export subdirs on different file systems?

Rakhesh Sasidharan rakhesh at rakhesh.com
Tue Aug 21 04:19:06 PDT 2007


Pieter de Goeje wrote:

> On Tuesday 21 August 2007, Rakhesh Sasidharan wrote:
>>> I have a directory /net/store. This directory is exported to all machines
>>> on my network.
>>>
>>> I have a sub-directory /net/store/photos. That too is exported to all
>>> machines on my network.
>>>
>>> What I want is that when I mount /net/store from another machine, the
>>> contents of /net/store/photos too be visible. Is there any way I can do
>>> that?
>>>
>>> From the manpage and the handbook and Google etc I get the idea that it
>>> might not be possible. Still, asking just in case there are any
>>> round-about ways ... I would assume a scenario like this is common.
>>>
>> Forgot to add: the two directories are imported "dynamically" on the
>> client side. So I can't just make fstab entries on the client side to
>> mount both points. I use AMD to mount /net/store when needed. And I can't
>> for the life of me figure how to make it mount /net/store/photos too when
>> needed -- I dont think that's possible(?) ...
> I have that configuration working.
> In /etc/exports:
> /pub    -alldirs        client
> /pub/video -alldirs     client
> On the client side, I didn't change anything to the configuration of AMD.
> Simply cd'ing to /host/server/pub and then 'cd video' does the right thing. I
> don't think -alldirs is really needed, but it's there for convenience.

Thanks Pieter. The default configuration mounts *all* the exported 
filesystems from host. Which should be fine, just that I don't want it 
that way (and I like complicating matters, I guess! :p).

Using the default way, I can access the exported filesystems as 
/host/server/net/store[/photos] -- which is not what I want. Rather, I 
want to 
access the exported /net/store[/photos] filesystems under the 
/net/store[/photos] mount points of the client -- and I don't want any 
other exported file systems in there either. Kind of like the "host" type 
amd filesystem, but only for a specific branch.

This is something I did come up with:

-----8<-----
/defaults       host!=obelix;type:=nfsopts:=rw,intr,grpid,nosuid
store           type:=auto;fs:=${map};pref:=${key}/
store/*         type:=nfs;rhost:=obelix;rfs:=${path}
-----8<-----

It does what I want -- /net/store/[anything] is mounted from the remote 
host (obelix) -- only problem (and the reason why I didnt go ahead with 
this) being that there's no way to see what all directories are available 
under /net/store. If do a "cd /net/store/music" it will work well; but if 
you do an "ls /net/store" it won't mount "/net/store" and show me what 
subdirs are available. And the "browseable_dirs" option in "amd.conf" does 
not help either coz its an "auto" type filesystem.

I had forgotten about the "host" filesystem type (the default). So thanks 
for pointing it out. Let me see if I can twiddle around and find a 
workaround. :)

Regards,

 				- Rakhesh
                                 http://rakhesh.com/


More information about the freebsd-questions mailing list