Nfs – Understanding NFS4 exports and pseudofilesystem

mountnfs

I think I understand the way pre-NFS4 exports work, specifically the namespace of the exported point.

(ie. export /mnt/blah on server, use mount server:/mnt/blah /my/mnt/point on client)

However, I'm having a hard time wrapping my head around NFS4 exports.

What I've been able to gather so far is that you export a 'root' by marking it with fsid=0, which you then import on the client side by referring to it as '/'.

(ie. exportfs -o fsid=0 /mnt/blah on server, mount server:/ on client)

However, after that, it gets a little weird. From my playing around, it seems I can't export anything else thats not under /mnt/blah. For example, exportfs /home/user1 fails when trying to mount from the client unless /mnt/blah/home/user1 exists on the server.

If this is the case, what is the difference between exportfs /mnt/blah/subdir1 on server and mount server:/subdir1 on client and just skipping the exportfs and mounting whatever subdir of /mnt/blah you want?

Why would you need to export anything other than the root? Its all in the same namespace anyway.

Best Answer

The purpose of this is to add an abstraction layer that gives you more flexibility; you can move things around on the server without having to reconfigure all the clients to reflect the new paths.

You can export stuff outside /mnt/blah by bind-mounting it inside blah, for instance

mount --bind /home /mnt/blah/home
Related Topic