NFSv3 shares not automatically remounted after NIC failure

Issues related to configuring your network
Post Reply
TK_Fin
Posts: 8
Joined: 2015/05/21 12:49:14

NFSv3 shares not automatically remounted after NIC failure

Post by TK_Fin » 2015/10/09 08:04:26

Hello everybody working with NFS,

we have here simple setup of two workstations and one server, all running CentOS 6.7 64bit. The server is serving home, data and application directories to the workstations via NFSv3.

It seems that our company's network is a bit unstable and sometimes the eth0 NIC goes down on one workstation. When this happens, the NFS directories are umounted and this causes running calculations to crash, which is rather inconvinient.
I have to manually mount the directories afterwards.

Our /etc/fstab at workstations have only NFS-keywords "vers=3, hard". I had thought from the documentation that "hard" would have stopped the above described event happening. Apparently not.
How do I configure the workstation not to drop the NFS-directories when eth0 goes down? I have been through the NFS-documentation, but could not find the relevant solution from there.

Best regards,
TK

User avatar
TrevorH
Site Admin
Posts: 33215
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: NFSv3 shares not automatically remounted after NIC failu

Post by TrevorH » 2015/10/09 09:24:17

I'd think you'd do better to work out what the problem is with your ethernet connection.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

TK_Fin
Posts: 8
Joined: 2015/05/21 12:49:14

Re: NFSv3 shares not automatically remounted after NIC failu

Post by TK_Fin » 2015/10/09 10:50:49

Thanks for the quick reply. I have contacted the people who take care of the network infrastructure at our company, but to no avail. If it's incorrectly configured router or whatever, I can't help that and seems to be something I have to just live with.
I am looking for a solution to make the workstations resilient against such problems.

User avatar
TrevorH
Site Admin
Posts: 33215
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: NFSv3 shares not automatically remounted after NIC failu

Post by TrevorH » 2015/10/09 11:04:37

The usual answer is autofs.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

TK_Fin
Posts: 8
Joined: 2015/05/21 12:49:14

Re: NFSv3 shares not automatically remounted after NIC failu

Post by TK_Fin » 2015/10/09 12:07:57

Thanks for pointing me to the right direction. I hadn't thought that I would need another tool to do this in addition to NFS.

For bookkeeping here is how I did it, in case somebody else needs to setup something like this and stumbles here via the search engines.
Example with a network home (/home2) and an application directory (/appl2) on a server 10.130.1.1.

1. Remove NFS-mounts for /home2 and /appl2 from /etc/fstab and umount them.
2. Replace /etc/auto.master with one line "/mnt /etc/auto.nfs".
3. Create /etc/auto.nfs where you add the mounts removed in part 1 in two lines: "appl2 -fstype=nfs 10.130.1.1:/appl2" and "home2 -fstype=nfs 10.130.1.1:/home2" (NOTE: do not add / here to the first parameter)
4. I also removed "nisplus" from /etc/nsswitch.conf's automount-line, but don't know if this made any difference. It was suggested in some forum that I found while figuring autofs out.
5. Restart autofs-service ("service autofs restart")
6. Create symbolic links in right places to point at the autofs mounts ("ln -s /mnt/appl2 /appl2" and "ln -s /mnt/home2 /home2").

Whoever
Posts: 1361
Joined: 2013/09/06 03:12:10

Re: NFSv3 shares not automatically remounted after NIC failu

Post by Whoever » 2015/10/10 18:08:14

TK_Fin wrote:Hello everybody working with NFS,

we have here simple setup of two workstations and one server, all running CentOS 6.7 64bit. The server is serving home, data and application directories to the workstations via NFSv3.

It seems that our company's network is a bit unstable and sometimes the eth0 NIC goes down on one workstation. When this happens, the NFS directories are umounted and this causes running calculations to crash, which is rather inconvinient.
I have to manually mount the directories afterwards.

Our /etc/fstab at workstations have only NFS-keywords "vers=3, hard".
I agree with the advice to use autofs. I always recommend this.

However, I think that your problem was only incidentally soved by using autofs.

Is there really a space between "vers=3" and "hard"? If so that may be your problem. The mount options should be:

Code: Select all

vers=3,hard
1. Remove NFS-mounts for /home2 and /appl2 from /etc/fstab and umount them.
2. Replace /etc/auto.master with one line "/mnt /etc/auto.nfs".
3. Create /etc/auto.nfs where you add the mounts removed in part 1 in two lines: "appl2 -fstype=nfs 10.130.1.1:/appl2" and "home2 -fstype=nfs 10.130.1.1:/home2" (NOTE: do not add / here to the first parameter)
4. I also removed "nisplus" from /etc/nsswitch.conf's automount-line, but don't know if this made any difference. It was suggested in some forum that I found while figuring autofs out.
5. Restart autofs-service ("service autofs restart")
6. Create symbolic links in right places to point at the autofs mounts ("ln -s /mnt/appl2 /appl2" and "ln -s /mnt/home2 /home2").
While this will work, it is quite a roundabout way to doing things. Also, you should not automount subdirectories in /mnt.

The simple solution is to install autofs, and ensure that the /net map is enabled (in auto.master), create an empty /net directory, then link from /home/home2 to /net/10.130.1.1/home2 and from /appl2 to /net/10.130.1.1/appl2

Alternatively, use autofs to mount all the subdirectores in /home and /appl2. You would do this with two entries in auto.master:

Code: Select all

/home               /etc/auto.home
/appl2             /etc/auto.appl2
Then create the map files /etc/auto.home and /etc/auto.appll2. These files can be quite simple if you use wildcards in the maps.

TK_Fin
Posts: 8
Joined: 2015/05/21 12:49:14

Re: NFSv3 shares not automatically remounted after NIC failu

Post by TK_Fin » 2015/10/12 07:29:11

I checked the original /etc/fstab and there was no space between "vers=3" and "hard".

Thanks for the tip with /net mounting, this is much easier way.

So, it is actually simple as:

1. Make sure that your NFS-server is in /etc/hosts.
2. See that you have line "/net -hosts" enabled in your /etc/auto.master
3. Just generate symbolic links "ln -s /net/10.130.1.1/home2 /home" and "ln -s /net/10.130.1.102/appl2 /appl2".

Post Reply