# [SOLVED] nfs containing mount points

## thekeymaker

I have been looking for an answer the last few day and was wondering if anyone knows this.

I have a media server that has the following directories:

/share/music

/share/movies

/share/photos

I have each of these directories mounted to different hard drives when the server boots in fstab.

I also have nfs running and sharing /share which I can successfully mount on another machine.  Only problem is that it doesn't show the files in each of these locally mounted directories. 

I did find on the ubuntu forms this post:

http://ubuntuforums.org/showthread.php?t=1165716

saying:

"If an exported directory has mount points under it, files under those mount points will not be accessible by NFS clients. So if you exported the root directory / and has a separate filesystem mounted at /home , you would need to also export /home and clients would need to mount it in order to see the files under it. "

Is this correct or is there a way I can have my local mounted file-systems show up?

Ideas?   :Sad: Last edited by thekeymaker on Wed Jul 11, 2012 10:13 pm; edited 2 times in total

----------

## Hu

That is correct.  Is there some reason you do not want to follow the advice given in the quoted passage?

----------

## thekeymaker

 *Hu wrote:*   

> That is correct.  Is there some reason you do not want to follow the advice given in the quoted passage?

 

No.  I was just wondering if in never versions of nfs that there was a way to make this work, since it is an older post.  Or what others might have done in the same situation, like maybe linking the files or using LVM to make all the media drives seem like one.  That last one might be a stretch.  But anyway.  Thank you for the reply Hu! I guess I will have to try some other things to achieve what I am looking for.

----------

## toralf

NFS generally prevents a NFS user from re-exporting and therefore exposing contents of directories which was exported by the original NFS exporter to (only) a dedicated group of clients AFAIK.

----------

## thekeymaker

Yay I found a solution!!!

Many thanks first to those who took the time to respond.

It is possible to mount a nfs that has directories that are mounted on the server side.  What you have to do is, using my example above, not only add to your /etc/exports file:

```
/share              ip (nohide,rw,sync,no_root_squash,no_subtree_check)
```

but also add this:

```

/share/music ip (nohide,rw,sync,no_root_squash,no_subtree_check)

/share/movies ip (nohide,rw,sync,no_root_squash,no_subtree_check)

/share/photos ip (nohide,rw,sync,no_root_squash,no_subtree_check)
```

The nohide is a critical part!  Now on the client like normal do 

```
mount  (ip server):/share  (mount point)
```

and you can see the files!   :Very Happy:   Magic!

----------

## Hu

 *thekeymaker wrote:*   

> also add this:
> 
> ```
> /share/music ip (nohide,rw,sync,no_root_squash,no_subtree_check)
> 
> ...

 You neglected to quote the relevant section of the manpage that explains why you should think carefully before doing this:

```
       nohide This option is based on the option of the same name provided  in

              IRIX  NFS.  Normally, if a server exports two filesystems one of

              which is mounted on the other, then  the  client  will  have  to

              mount  both filesystems explicitly to get access to them.  If it

              just mounts the parent, it will see an empty  directory  at  the

              place where the other filesystem is mounted.  That filesystem is

              "hidden".

              Setting the nohide option on a filesystem causes it  not  to  be

              hidden,  and  an appropriately authorised client will be able to

              move from the parent to that  filesystem  without  noticing  the

              change.

              However,  some  NFS clients do not cope well with this situation

              as, for instance, it is then possible for two files in  the  one

              apparent filesystem to have the same inode number.

              This option can be very useful in some situations, but it should

              be used with due care, and only after confirming that the client

              system copes with the situation effectively.
```

----------

