5

Whenever I have to reboot server1, the only way I can get NFS mounts back up on server2 is to change one of the "fsid" integers in the /etc/exports file on server1. Otherwise, the mount -a command just hangs on server2.

Typical Scenario:

Server1 is rebooted. On server1, I have two lines of code in /etc/exports:

/mnt/ramdisk/dir1 *(fsid=0,rw,no_root_squash,no_subtree_check,async)
/mnt/ramdisk/dir2 *(fsid=1,rw,no_root_squash,no_subtree_check,async)

I issue this command:

"exportfs -r".

On server2, I have this in /etc/fstab:

xxx.xxx.x.x:/server1_dir1/ /dir1_server2 nfs async,noatime 0 0
xxx.xxx.x.x:/server2_dir2  /dir2_server2 nfs async,noatime 0 0

I first "umount" the old dirs that now have stale NFS handles. Then,

"mount -a"

The command hangs. After I kill it, df shows dir1 mounted, but dir2 did not.

The only way to get both dirs to mount is to change the fsid integer to something else. For example, on server1 we now have:

/mnt/ramdisk/dir1 *(fsid=0,rw,no_root_squash,no_subtree_check,async)
/mnt/ramdisk/dir2 *(fsid=2,rw,no_root_squash,no_subtree_check,async)

I changed fsid=1 to =2. I again issue the exportfs -r command, and voila, the mount -a command works on server2.

Perhaps I do not understand what fsid really does, but obviously there must be a better way to "remount" NFS than having to randomly edit the fsid number every time?

EDIT: If I do not have fsid included in my exports file on server1, it gives me

"Warning: /mnt/ramdisk/dir1 requires fsid= for NFS export" 

And, if I set fsid=0 for both lines (dir1 and dir2), then the mount points end up being the same as all my files were being copied to the dir1 location! So it seems the only way for this to work is to constantly switch fsid integers, somewhat randomly.

EDIT2: I removed fsid=0 since it is "special", and changed them to fsid=1 and fsid=2 in /etc/exports on server1. This of course worked (since file was changed). But today just had to reboot forcibly, and after (slowly) unmounting the stale drives from server2, mount -a failed, as before. So, (as before), I edited the exports file on server1, this time, fsid=2 and fsid=3, exportfs -r, and voila, mount -a works again on server2. Back to square 1.

EDIT3 Critical info: If I take everything down in a controlled manner (i.e...server1 does not "crash"), and first unmount the dirs on server2, then reboot server1, THEN mount -a on server2, it works great. It's only when the mounts on server2 are abruptly cut off that this problem occurs. So I"m guessing something needs to be reset on server2? I know it takes a long time to unmount the stale handles on server2 after server1 crashes.

7
  • Why are you specifying fsid= in the first place, and are these directories not both on the same FS (/mnt/ramdisk)?
    – MadHatter
    Mar 1, 2015 at 7:40
  • If I do not specify fsid=, then when I exportfs it says: "Warning: /mnt/ramdisk/dir1 requires fsid= for NFS export" (same warning for dir2 as well). I used to have them both fsid=0, but I have been randomly changing the values in order to get it to mount on other machine. Mar 1, 2015 at 8:04
  • ALSO, if I set fsid=0 for both dir1 and dir2, then they end up being the same mount point apparently! Mar 1, 2015 at 17:17
  • 2
    fsid=0 has a special meaning; you generally should not be using it, and certainly not in this scenario. Mar 1, 2015 at 17:29
  • @MichaelHampton please re-post your comment as a proper answer, preferably with an explanation.
    – kofemann
    Mar 2, 2015 at 8:34

1 Answer 1

5

My guess would be that the problem is caused by the use of fsid=0 in one of your exports.

Remember that the fsid is meant to uniquely identify devices when the underlying filesystem driver doesn't provide its own unique IDs. And in particular, fsid=0 has a special meaning:

For NFSv4, there is a distinguished filesystem which is the root of all exported filesystem. This is specified with fsid=root or fsid=0 both of which mean exactly the same thing.

Since this clearly isn't what you want, always use an fsid other than 0.

1
  • I changed them to fsid=1 and fsid=2. It worked the first time, but then I had to reboot server1, which messed up the nfs mounts on server2. After some time, I was finally able to umount dir1 and dir2 from server2. Now that server1 is up, I did "mount -a" on server2, but timed out. I had to "fudge", again, fsid=2 and fsid=3 this time (since it was already 1 and 2). Mar 2, 2015 at 18:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .