View previous topic :: View next topic |
Author |
Message |
joanandk Apprentice
Joined: 12 Feb 2017 Posts: 169
|
Posted: Mon Dec 17, 2018 8:32 pm Post subject: exportfs mountpoint issues |
|
|
Hi,
Did anyone else happen to see a very peculiar bug or feature with exportfs? I was migrating my nfs to nfs4. I have exported the home directory on the server. As nfs4 requires dedicated root directory
Code: | /exports
/exports/home
/exports/portage
/exports/storage
/exports/vm
|
I created the /nfs directory under the root directory /. I have my files over several virtual drives (home and portage are on sda2, storage and vm are on sdb1). I bind-mounted the different files under /nfs.
As I wanted to besure that the shares are only available, if the directories are mounted:
Code: | /nfs <MY_NET>(ro,fsid=0)
/nfs/home <MY_NET>(rw,mp,no_root_squash,no_subtree_check)
/nfs/portage <MY_NET>(ro,mp,no_root_squash,no_subtree_check)
/nfs/storage <MY_NET>(rw,mp,no_root_squash,no_subtree_check)
/nfs/vm <MY_NET>(rw,mp,root_squash,no_subtree_check) |
Then I tried to verify that my autofs is working and came across the bug:
On the client pc, mounting storage and vm were successful and I saw the files.
Mounting home and portage was successful, but no files were visible.
After frustrating trial and errors over an hour (change root_squash and trying to change order of the export list), I found out that the "mp" option is the cause of the problem. If the bound directory orginates from the same partition where the nfs-root lies, then the client sees no files inside the mounted directory!
If the bound directory lies on other disk, the option "mp" seems to show the content.
So, if anyone has similar problem: just remove mp-option (after thinking, I must say it could also be a feature, as you cannot mount-bind another directory form the same partition if the mounting of the partition has failed!) for all shares which lies on the same partition as the nfs-root directory:
Code: | /nfs <MY_NET>(ro,fsid=0)
/nfs/home <MY_NET>(rw,no_root_squash,no_subtree_check)
/nfs/portage <MY_NET>(ro,no_root_squash,no_subtree_check)
/nfs/storage <MY_NET>(rw,mp,no_root_squash,no_subtree_check)
/nfs/vm <MY_NET>(rw,mp,root_squash,no_subtree_check) |
Hope this will prevent other people from loosing their time and mind. |
|
Back to top |
|
|
Schnulli Guru
Joined: 25 Jun 2010 Posts: 320 Location: Bremen DE
|
Posted: Wed Jan 23, 2019 11:35 pm Post subject: |
|
|
Hi
try this in a box and see if the NFS Server is running and has working exports
# showmount -e <ip>
# showmount --exports <ip>
Dont forget to open the Firewall Ports 111&2049 TCP&UDP to use NFS
Regards |
|
Back to top |
|
|
Ant P. Watchman
Joined: 18 Apr 2009 Posts: 6920
|
Posted: Thu Jan 24, 2019 2:37 am Post subject: |
|
|
Putting all NFSv4 exports into a single directory hasn't been a requirement for a long time, whatever documentation you were using is outdated.
Here's what my /etc/exports looks like, for example:
grep -v '^#' /etc/exports | sed 's/\s\([a-z]\)\+\b/ \1/g': | /etc/portage -rw,no_subtree_check,no_root_squash n
/etc/portage -ro,no_subtree_check r
/home -rw,no_subtree_check n r
/srv/http-replicator -ro,no_subtree_check n r
/srv/www -rw,no_subtree_check n r
/usr/local -ro,no_subtree_check n r
/usr/src -ro,no_subtree_check n r
/var/cache/distfiles -rw,no_subtree_check,no_root_squash n r
/var/cache/eix -ro,no_subtree_check n r
/var/db/repositories -ro,no_subtree_check n r |
|
|
Back to top |
|
|
joanandk Apprentice
Joined: 12 Feb 2017 Posts: 169
|
Posted: Sun Feb 03, 2019 9:47 pm Post subject: |
|
|
Schnulli wrote: | Hi
try this in a box and see if the NFS Server is running and has working exports
# showmount -e <ip>
# showmount --exports <ip>
Dont forget to open the Firewall Ports 111&2049 TCP&UDP to use NFS
Regards |
I think you might have missunderstood my post: Mounting works fine, so no firewall issue. "showmount -e <SERVER>" works fine too. But if I have the option "mp" on the exported directory which is on the same drive as the "bind" mountpoint, the share is empty on the client.
But if I omit the "mp" option for the shares which lie on the same drive where the "bind"-directory is, then everything works fine.
Ant P. wrote: | whatever documentation you were using is outdated. |
I am no expert on nfs4 share. But the documentation I have read were from 2017. It is a archwiki about nfs shares.
I happen to see that the shares can be done as you suggest. So it is only personal opinion if one uses a dedicated root directory (in my case) or "direct" mapping as you do.
BR |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|