0

I have three Raspberry Pis running Raspbian. One is serving as an NFS NAS, the other two are load-balanced web servers running NGINX. The configuration is like this:

On the NAS (10.34.0.40):

root@nas:~# cat /etc/exports
/drupal 10.34.0.10(rw,sync,no_root_squash,no_subtree_check) 10.34.0.20(rw,sync,no_root_squash,no_subtree_check,fsid=0)
/wordpress 10.34.0.10(rw,sync,no_root_squash,no_subtree_check) 10.34.0.20(rw,sync,no_root_squash,no_subtree_check,fsid=0)

On the WEB1 (10.34.0.10) server:

root@web1:~# cat /etc/fstab
proc            /proc           proc    defaults          0       0
/dev/mmcblk0p1  /boot           vfat    defaults          0       2
/dev/mmcblk0p2  /               ext4    defaults,noatime  0       1
nas:/drupal     /usr/share/nginx/html/drupal    nfs     hard,intr       0   0
nas:/wordpress  /usr/share/nginx/html/wordpress nfs     hard,intr   0   0

On the WEB2 (10.34.0.20) server:

root@web2:~# cat /etc/fstab
proc            /proc           proc    defaults          0       0
/dev/mmcblk0p1  /boot           vfat    defaults          0       2
/dev/mmcblk0p2  /               ext4    defaults,noatime  0       1
nas:/drupal     /usr/share/nginx/html/drupal    nfs     hard,intr   0   0
nas:/wordpress  /usr/share/nginx/html/wordpress nfs     hard,intr       0   0

The two fstabs are identical (in fact,the two web servers have identical configurations provisioned with ansible). However, while WEB1 mounts the two mountpoints correctly, WEB2 mounts the nas:/drupal directory to both /usr/share/nginx/html/drupal and /usr/share/nginx/html/wordpress. In other words, when I do an ls /usr/share/nginx/html/wordpress, I get the contents on nas:/drupal, not nas:/wordpress.

If I do a df on both systems I get:

WEB1:

root@web1:~# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        30G  4.8G   24G  18% /
devtmpfs        459M     0  459M   0% /dev
tmpfs           463M     0  463M   0% /dev/shm
tmpfs           463M  6.3M  457M   2% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           463M     0  463M   0% /sys/fs/cgroup
/dev/mmcblk0p1   60M   21M   40M  35% /boot
nas:/drupal      15G  3.8G   11G  28% /usr/share/nginx/html/drupal
nas:/wordpress   15G  3.8G   11G  28% /usr/share/nginx/html/wordpress
tmpfs            93M     0   93M   0% /run/user/1001

WEB2:

root@web2:~# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        30G  3.2G   25G  12% /
devtmpfs        459M     0  459M   0% /dev
tmpfs           463M     0  463M   0% /dev/shm
tmpfs           463M  6.3M  457M   2% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           463M     0  463M   0% /sys/fs/cgroup
/dev/mmcblk0p1   60M   21M   40M  35% /boot
nas:/drupal      15G  3.8G   11G  28% /usr/share/nginx/html/drupal
tmpfs            93M     0   93M   0% /run/user/1001

So it looks like WEB2 is not mounting the nas:/wordpress share.

I should note that both nas:/drupal and nas:/wordpress have exactly the same permissions.

Can anyone tell me what is going on here?

  • nfsstat -m on WEB2 gives the following result: <snip> /usr/share/nginx/html/wordpress from nas:/drupal Flags: rw,relatime,vers=3,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=10.34.0.40,mountvers=3,mountport=34053,mountproto=udp,local_lock=none,addr=10.34.0.40 </snip> – discordare Aug 24 '16 at 15:48
  • What's the output of ls -ld /usr/share/nginx/html/wordpress on web2 ? Is it a symlink? – Mark Plotnick Aug 24 '16 at 15:49
  • It is not a symlink. ls -ld /usr/share/nginx/html/wordpress/ drwxr-xr-x 2 root root 4096 Aug 24 08:56 /usr/share/nginx/html/wordpress/ – discordare Aug 24 '16 at 15:50
  • You have set the same fsid=0 in the exports for both filesystems only for web2, but they are probably different filesystems. – meuh Aug 24 '16 at 16:04
  • Yup, I had just noticed that and made the change, and lo and behold everything is fine now. But that does not explain why the two systems treated the mount differently. I would have expected WEB1 to exhibit the same behavior as WEB2. If it had I probably would have figured out the fsid issue sooner. – discordare Aug 24 '16 at 16:10
0

The problem is your fsid=0 value.

If we look at the exports entries we can split them into the two hosts:

10.34.0.10(rw,sync,no_root_squash,no_subtree_check)
10.34.0.20(rw,sync,no_root_squash,no_subtree_check,fsid=0)

So for the .10 client the exports will have different FSIDs, but on the .20 client, both shares will appear to have the same FSID.

Thus the .10 client will see both exports correctly, but the .20 will be confused.

Remove the ,fsid=0 value and things should work correctly for both clients.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.