How to explain NFS crossmnt argument?

nfs
rajat banerjee picture rajat banerjee · Dec 2, 2013 · Viewed 17.1k times · Source

A client of mine discovered that he needs to include 'crossmnt' along with his NFS export options. I am going to write the option into our software, so that he doesn't have to put in a hack and can use crossmnt as a real option.

Is this a correct explanation of crossmnt that I can use in our docs?

Crossmnt allows the NFS client to traverse the directories below the exported root. For example: etc/exports:

/exports      *(fsid=0,ro,root_squash,sync)
/exports/doc  *(ro,root_squash,bind=/usr/share/doc)

With crossmnt, the client can see the contents of /exports/doc as the subfolder of /exports, while without crossmnt, doc would appear to be an empty folder.

This video was used for an example: https://www.youtube.com/watch?v=-9cJciX8dB8

Does that sound right? Thank you.

Answer

Vitor picture Vitor · Sep 17, 2014

I believe that there is something missing in this explanation.. what i know from crossmount is that it allows you to see a mounting point inside an exported directory. If the exported directory doesn't have any partition mounted over its subfolders, they should be visible in the client side of the NFS.

For example, if you have an exported directory over "/mnt/testing_dir", with this content:

/mnt/testing_dir/
                 dir1/
                           text1.txt
                           executable.bin
                 dir2/ (mount point for /dev/sda6)
                           doc1
                           doc2

The "dir1" will be visible even if without the "crossmnt" option. However, "dir2", as it is a mounting point, will be visible with the "crossmnt" option, and will be empty without it (unless you use another options like "nohide").

Reference:

crossmnt - This option is similar to nohide but it makes it possible for clients to move from the filesystem marked with crossmnt to exported filesystems mounted on it. Thus when a child filesystem "B" is mounted on a parent "A", setting crossmnt on "A" has the same effect as setting "nohide" on B.