Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
NFS-client does not shutdown when NFS-server is offline
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Lomaxx
Tux's lil' helper
Tux's lil' helper


Joined: 11 Nov 2004
Posts: 112

PostPosted: Thu Aug 28, 2008 8:25 am    Post subject: NFS-client does not shutdown when NFS-server is offline Reply with quote

I have two Gentoo-computers in a local network. One is the NFS-Server. The other is a NFS-client which is configured to use the NFS-mounts via autofs or manually via the 'mount'-command (an fstab-entry exists) for ordinary datastorage-transfer (i.e storing/accessing music and movies). Everything works fine, except for the fact, that in certain cases the client hangs on shutdown, when i turned off the server before.

The reason for this, is that the client keeps trying to reach the NFS-server in order to unmount the shared directories. I experimented a little bit and noticed two different points, where the computer freezes on shutdown:


Situation 1:
If i manually mount the the share by using 'mount /mnt/client_storage', later forget to unmount the share, then turn off the server and afterwards try to shut down the client, then the shutdown-process halts rather early. fstab-entry looks like this:

server:/mnt/storage /mnt/server_storage nfs rw,_netdev,user,noatime,noauto,nfsvers=3 0 0

This means i must not forget to unmount the shares before shutting down the server in order to make the client shutdown correctly

Situation 2:
I am getting the same result if i use autofs to mount the shares and shutdown the server before autofs unmounts the share. I helped myself by setting the time-out-value of autofs for unmounting not used mounts to "1" (second). This way i only have to remember to close all applications and terminals that access the shared directories before shutting down the server.

Situation 3:
However i still ran into problems when using autofs after it unmounted the shares. The shutdown-process then halts later than in situation 1 and 2. Not while the NFS-script is stopping, but later on when unmounting drives. I managed to get arround this by replacing the "hard"-parameter with the 'soft'-parameter in /etc/autofs/auto.net.

Anyway after all this confusion: What i would like to have is a setup, where the NFS-server on shutdown would send a signal to the client saying "hey you are still using some of my shares. please unmount all shares." and halts until all clients do so. Additionally the client should determine if it gently could unmount the drives when there is no write-access going on, but only a terminal is still left open that is accessing a shared-directory. Is something like this possible with NFS? Or should i switch to alternatives like 'sshmount'. Which is the best setup for a home-network for sharing media from one computer to another?

Lomaxx
Back to top
View user's profile Send private message
fangorn
Veteran
Veteran


Joined: 31 Jul 2004
Posts: 1886

PostPosted: Thu Aug 28, 2008 8:44 am    Post subject: Reply with quote

As NFS is designed as a stateless connection AFAIK (aka. expect the server running and serving all the time), NFS client is waiting till the server is up again. You can adjust timeouts for error messages, so your client won't hang forever waiting on response, but you cannot advise NFS server or client to acknoledge a server shutdown.

It is a big No-No shutting down a server before the last client exits!!!! :twisted:
_________________
Video Encoding scripts collection | Project page
Back to top
View user's profile Send private message
Lomaxx
Tux's lil' helper
Tux's lil' helper


Joined: 11 Nov 2004
Posts: 112

PostPosted: Thu Aug 28, 2008 11:42 am    Post subject: Reply with quote

Thanks for your answer fangorn.

So what would be a better solution? sshmounts? ftpmounts? something else? Which are the user-friendliest with nice performance and options?
Back to top
View user's profile Send private message
kimmie
Guru
Guru


Joined: 08 Sep 2004
Posts: 531
Location: Australia

PostPosted: Fri Aug 29, 2008 3:00 am    Post subject: Reply with quote

You're probably best off using samba on the server and cifs mounts on the gentoo client. Then you'll be able to connect windows clients too (pesky things, they keep popping up).
Back to top
View user's profile Send private message
pappy_mcfae
Watchman
Watchman


Joined: 27 Dec 2007
Posts: 5999
Location: Pomona, California.

PostPosted: Fri Aug 29, 2008 5:54 am    Post subject: Reply with quote

Samba is a good thing. However, if you decide to go that route, steer clear of smb4k. It is a computer killer. Well, not a killer, but it nuked a dozen icons and their directory for no good reason. If you think you have trouble with NFS, it's a picnic compared to what smb4k can do.

You can create scripts to mount and unmount the desired shares, and you can do it with Windoze boxes or Llinux boxes. Doing it that way is infinitely more fault tolerant. It won't completely eliminate the problem. but it will make it better.

The best idea is still turning off the client machine first. I always make sure I shut down the laptops before the server. That way, problems averted.

Blessed be!
Pappy
_________________
This space left intentionally blank, except for these ASCII symbols.
Back to top
View user's profile Send private message
drescherjm
Advocate
Advocate


Joined: 05 Jun 2004
Posts: 2792
Location: Pittsburgh, PA, USA

PostPosted: Fri Aug 29, 2008 5:37 pm    Post subject: Reply with quote

Quote:
Situation 3:
However i still ran into problems when using autofs after it unmounted the shares. The shutdown-process then halts later than in situation 1 and 2. Not while the NFS-script is stopping, but later on when unmounting drives. I managed to get arround this by replacing the "hard"-parameter with the 'soft'-parameter in /etc/autofs/auto.net.


That is what I have had to do on work network to avoid this problem. We have been using soft mounts for years without problems. Eventually we will move to cifs and samba since dfs finally works with 2.6.26 kernels but the 2.6.26 kernel does not work with xen or openvz so that will keep us from upgrading.
_________________
John

My gentoo overlay
Instructons for overlay
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum