Turning off NFS server and client sequence

Hi,

I have a PC running Freenas and an older box running openmediavault and both have the NFS server running. On my opensuse 42.2 and 13.2 laptops I run the NFS client setup via yast. I use the NFS server options ‘rw,no_root_squash,sync’ on both servers and for the NFS client ‘rw,hard,intr’. So far everything works fine, that is accessing, reading and writing files.

However, I have a habit of powering off the two servers when no longer required during the day (saving power costs- yes really) and continue working with the laptops. Some file explorer apps like dolphin and PCManFM (on my lxde laptop) with a NFS connection freeze - this I can understand. But I have noticed that when I shutdown the laptops at the end of the day, the shutdown scripts are looping for a very long time trying to shutdown the NFS client. I have to eventually kill the laptops via the power switch.

I have tried many NFS client options to try and mitigate the shutdown script looping without any success.

So my question really is - should a laptop with a NFS client be shutdown BEFORE the NFS server or are there NFS client options that negate this app freeze and shutdown issue if the NFS server goes off first?

Thanks,
Chris.

Consider using AutoFS for the NFS mounts. It has a timeout feature which can automate unmounting when a remote file system is not in use.

Just one of many good references…

https://wiki.archlinux.org/index.php/Autofs#NFS_network_mounts

An openSUSE guide…

https://doc.opensuse.org/documentation/leap/reference/html/book.opensuse.reference/cha.autofs.html

Thank you, I shall have a read of that Autofs tomorrow.

But I take it that under ‘normal circumstances’ it is not wise to turn a NFS server off before disconnecting the client?

I would say that in general it is not a good idea. Practical it will depend on what the client(s) are doing at that moment in time. Thinking about the case that the client is writing to a file gives me the shivers.

Hello,

had a play with autofs this morning - could not get it to work with 13.2 as per the guide

An openSUSE guide…

https://doc.opensuse.org/documentati…ha.autofs.html

But it did work very well on my 42.2 laptop. However, it did suffer the same issue with my NFS client setup in that if the NFS server is turned off first then when rebooting or shutting down the 42.2 laptop then it loops stop job messages -


A stop job is running for Automounts filesystem on demand...

(which went for around 3 minutes)

then

A stop job is running for /nfs/main2t...

which is the share from the NFS server mounted on the laptop and looped for around 6 minutes before I killed the laptop via the power button.

Autofs looks easier than NFS client but I think as Henk intimated that turning off a file sharing server before a client is not a good idea.

Thanks,
Chris.

Autofs looks easier than NFS client but I think as Henk intimated that turning off a file sharing server before a client is not a good idea.

Thanks,
Chris.

That is good advice in general. You also need to understand that AutoFS has a default timeout period of 600 seconds. Refer refer to the DEFAULT_TIMEOUT=variable in /etc/sysconfig/autofs. That can be changed (for each client) to a few seconds if desired.

It can also be adjusted per mount basis as explained in the guide…
https://doc.opensuse.org/documentation/leap/reference/html/book.opensuse.reference/cha.autofs.html#sec.autofs.nfs

Did some more testing this afternoon. I had later realized that in my previous test that I a connection to the NFS server share via my terminal. When I had now made sure that the terminal was closed and the timeout had been reached (ie PCManFM file explorer is closed) I shutdown the server. Now my laptop reboots without any ‘…stop job…’ messages hanging the system.

I’m beginning to like what I see with AutoFS :slight_smile:

However, still not sure why my 13.2 laptop fails to connect via AutoFS (Firewall has NFS Client service allowed etc). Would you know if there is a 13.2 vs 42.2 issue? There doesn’t seem to be a document for 13.2 at https://doc.opensuse.org/ anymore that I can refer to.

Thanks,
Chris.

Yes, it offers a convenient and flexible solution for mounting remote file systems on demand, especially when tuned to suit the needs of the users.

However, still not sure why my 13.2 laptop fails to connect via AutoFS (Firewall has NFS Client service allowed etc). Would you know if there is a 13.2 vs 42.2 issue? There doesn’t seem to be a document for 13.2 at https://doc.opensuse.org/ anymore that I can refer to.

Thanks,
Chris.

It should work just the same. I had openSUSE 13.2 running on an old laptop, which has been upgraded to openSUSE Leap 42.2, and AutoFS was running fine. You could start another thread specifically to deal with that, although as 13.2 is now EOL you should probably just consider upgrading it (assuming it is a 64-bit machine of course).

Thanks. I’ll redo the 13.2 laptop over the weekend - maybe I have a typo somewhere.

FYI - I am keeping the 13.2 on my Asus laptop for a while longer. My experience with 42.1 and 42.2 on my HP dv6 laptop has been “not quite satisfactory” compared to when it ran 13.2. Suffice to say I have had to re-install Leap a few times over the last 4 months and moved away from Plasma to LXDE. Hard to start a new thread with only “it’s wonky” or “it is unstable” or “I’m suspicious about…” comments :wink:

Regards,
Chris.

Followup to 13.2 issue -

After reading the man page for auto.master I edited that file so that the map-type of ‘file’ was now specifically added. So now my entry in auto.master is

/nfs file:/etc/auto.nfs --timeout 60

And now 13.2 works fine. Leap 42.2 didn’t require the map-type - maybe assumes by default???

I don’t recall having to do that explicitly with openSUSE 13.2, but good to read that it is working for you now. :slight_smile: