Welcome! Log In Create A New Profile

Advanced

HOWTO : NFS

Posted by Gravelrash 
Re: HOWTO : NFS
June 22, 2016 03:43PM
notoneofmyseeds Wrote:
-------------------------------------------------------
> know of a way that I could adjust my account so
> notifications are sent me on threads that I
> comment on.

Use the "Follow Topic" button at the bottom of the post.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: HOWTO : NFS
January 06, 2025 06:38PM
On a debian client, I found autofs very convenient. Install autofs if you have not already.

You create and edit two configuration files.

The first file /etc/auto.master.d/nfs.autofs, you specify
  1. a parent directory (I use /nfs) of all NFS mount points (but don't create individual mount points)
  2. the path of the second configuration file.
# cat /etc/auto.master.d/nfs.autofs
/nfs /etc/auto.nfs

In the second configuration file, each line specifies the mount point, and the server NFS share.
# cat /etc/auto.nfs
nas1_vol1  192.168.1.71:/volume1/Volume1
nas2_vol2  192.168.1.38:/nas2/nfs/share

Restart auto
service autofs restart

If everything is setup correctly, the NFS share will be auto-mounted on demand.
$ ls /nfs/nas2_vol2
... files show up ...

This is useful for example when you run media server on one linux box that's separate from the NAS box. You kind of like to have the NFS share automatically mounted on access, but OTOH you don't want the NFS share mounted at boot time.



Edited 4 time(s). Last edit at 01/11/2025 10:22PM by eno789.
Re: HOWTO : NFS
January 06, 2025 08:53PM
eno789,

Thanks! I do use it for NFS, but failed to recommend it anywhere here (other than when we discussed automounting USB drives).

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: HOWTO : NFS
January 06, 2025 09:09PM
eno789,

There is a gotcha in using autofs. It's been many years so I don't know if it still exists.

The automounted NFS shares will time out after a while without any access (don't remember the exact period). It's all good, because the share name is removed automatically when that occurs.

But during the period that a NFS share is mounted, if the server is going down or disconnected from the network, and we access the share, it will result in a hang forever!

If you'd like, beefing up your post with this test. I think it is good to add another section (4) to Gravelrash's 1st post and point it to your post.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: HOWTO : NFS
January 07, 2025 10:47AM
bodhi, reading https://unix.stackexchange.com/questions/29196/automount-nfs-autofs-timeout-settings-for-unreliable-servers-how-to-avoid-han (itself a thread 13 years old) there're a lot of options. Would take some time to find out the current situation and test it out.
Re: HOWTO : NFS
January 07, 2025 02:13PM
eno789,

> Would take some time to find out the
> current situation and test it out.

Yeah. I would just check one scenario (Linux to Linux): connect serial console to the NFS server, automount the share at the client, and then bring the network down on the server. Access the share on the client. If it hang, you can just wait to see how long it will take (the old behavior is forever). And then bring the network up at the server. If that does not break the hang then you'll have to kill the command that accessed the share (e.g. ls command), or the client ssh session.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: