Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved] How? unmount NFS when connection lost
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
hoacker
Guru
Guru


Joined: 04 Aug 2007
Posts: 505
Location: Bürstadt, Germany

PostPosted: Tue Sep 30, 2008 5:52 pm    Post subject: [solved] How? unmount NFS when connection lost Reply with quote

When a connection to a server is lost while a NFS share of this server is still mounted my box stops during shutdown when it tries to unmount the NFS mount. I know that loosing the connection is not a good thing at all, but IF the connection is lost, what to do to shutdown properly?

Last edited by hoacker on Sat Oct 04, 2008 6:53 pm; edited 1 time in total
Back to top
View user's profile Send private message
peaceful
Apprentice
Apprentice


Joined: 06 Jun 2003
Posts: 287
Location: Utah

PostPosted: Thu Oct 02, 2008 8:26 pm    Post subject: Reply with quote

umount -f

From "man umount":

-f Force unmount (in case of an unreachable NFS system). (Requires kernel 2.1.116 or later.)
Back to top
View user's profile Send private message
hoacker
Guru
Guru


Joined: 04 Aug 2007
Posts: 505
Location: Bürstadt, Germany

PostPosted: Thu Oct 02, 2008 8:54 pm    Post subject: Reply with quote

Yes, I know the "force" option, but how "force" unmount during the shutdown process?
Back to top
View user's profile Send private message
peaceful
Apprentice
Apprentice


Joined: 06 Jun 2003
Posts: 287
Location: Utah

PostPosted: Thu Oct 02, 2008 8:58 pm    Post subject: Reply with quote

Add "umount -f /your/mounted/directory" to /etc/conf.d/local.stop
Back to top
View user's profile Send private message
hoacker
Guru
Guru


Joined: 04 Aug 2007
Posts: 505
Location: Bürstadt, Germany

PostPosted: Thu Oct 02, 2008 9:09 pm    Post subject: Reply with quote

peaceful wrote:
Add "umount -f /your/mounted/directory" to /etc/conf.d/local.stop


Thanks, I'll try that. Didn't know local.stop, might be useful to keep it that in mind...
Back to top
View user's profile Send private message
peaceful
Apprentice
Apprentice


Joined: 06 Jun 2003
Posts: 287
Location: Utah

PostPosted: Thu Oct 02, 2008 9:24 pm    Post subject: Reply with quote

local.start is executed after normal startup. local.stop is executed before normal shutdown. They're pretty useful in cases like this. :)
Back to top
View user's profile Send private message
arth1
n00b
n00b


Joined: 29 Nov 2006
Posts: 24

PostPosted: Sat Oct 04, 2008 3:48 pm    Post subject: Re: How? unmount NFS when connection lost (during shutdow) Reply with quote

hoacker wrote:
When a connection to a server is lost while a NFS share of this server is still mounted my box stops during shutdown when it tries to unmount the NFS mount. I know that loosing the connection is not a good thing at all, but IF the connection is lost, what to do to shutdown properly?


Mount the NFS share with the "soft" or "intr" options. The soft option will allow NFS to fail when timing out, and not retrying eternally. The "intr" option allows the NFS process to be stopped if it has timed out.

Caveat: If an NFS write was in progress when the timeout occurred, it will not complete after it comes back online again if using "soft".
Back to top
View user's profile Send private message
hoacker
Guru
Guru


Joined: 04 Aug 2007
Posts: 505
Location: Bürstadt, Germany

PostPosted: Sat Oct 04, 2008 4:00 pm    Post subject: Re: How? unmount NFS when connection lost (during shutdow) Reply with quote

arth1 wrote:
Mount the NFS share with the "soft" or "intr" options.

I'll mount nfs with every option but "soft" as this may cause data curruption. The option "intr" may be an option for me. Thanks, arth1.
Back to top
View user's profile Send private message
hoacker
Guru
Guru


Joined: 04 Aug 2007
Posts: 505
Location: Bürstadt, Germany

PostPosted: Sat Oct 04, 2008 6:53 pm    Post subject: Re: How? unmount NFS when connection lost (during shutdow) Reply with quote

hoacker wrote:
The option "intr" may be an option for me.

Just putting "intr" in FSTAB is not the solution, shutdown still hangs during unmount. I'll keep it in FSTAB anyway as it seems to be a nice option. Umount in local.stop works quite well, so I consider my problem solved.

Thanks again, you two.
Back to top
View user's profile Send private message
chris...
Apprentice
Apprentice


Joined: 26 Sep 2006
Posts: 179
Location: Melbourne, AU

PostPosted: Fri Mar 20, 2009 10:56 pm    Post subject: Reply with quote

Code:
umount -f /directory/


doesnt work for me
Back to top
View user's profile Send private message
musv
Advocate
Advocate


Joined: 01 Dec 2002
Posts: 3369
Location: de

PostPosted: Sat Mar 21, 2009 12:15 am    Post subject: Reply with quote

I had a lot of problems with umount -f. In most cases umount -l did a better job for me.
Back to top
View user's profile Send private message
chris...
Apprentice
Apprentice


Joined: 26 Sep 2006
Posts: 179
Location: Melbourne, AU

PostPosted: Sat Mar 21, 2009 3:12 am    Post subject: Reply with quote

most cases?
Back to top
View user's profile Send private message
musv
Advocate
Advocate


Joined: 01 Dec 2002
Posts: 3369
Location: de

PostPosted: Sat Mar 21, 2009 11:26 am    Post subject: Reply with quote

My knowledges about the technical aspects of nfs are quite limited. I was using it to share some directories in my local web. Now I'm beginning to migrate all the read-only stuff to nbd or AoE because of performance reasons. My fstab looks like that (I use it to compile the stuff for the slow box on my big computer):
Code:
fehlermelder:/  /mnt/fehlermelder       nfs     noauto,wsize=8192,rsize=8192,hard,intr  0 0

intr - should allow the interrupt nfs transactions in case of a time-out
hard - in case of a major timeout tries to continue instead of showing the message "server not responding"

My limited experience:
You have a server, sharing some directories. On the client some of those directories are mounted. Now the server crashes or there's some other trouble with the network connection. If you try to unmount the shared directories on the client, the umount commando hangs. I've never realized so solve that problem with "umount -f". Rather with "-f" I remember to crash the whole system in rare cases. I'm using Linux now for more than 6 years. In all that time the behaviour of nfs didn't change. And to make matters worse, if you try to reboot the client, it will hang while unmounting the network filesystems. Only solution is a hard-reset of the machine or using the Magical SysRQ key.

The funny thing: If you have on the client mounted nfs-shares and reboot the server, the client is able to unmount the shares after the server finished restarting and sharing the directories again.

umount -l:
I don't remember where I got this hint. "-l" is a lazy unmount. The filesystem will be unmounted as soon as possible (man-page). With that option I had more success than with "-f". I wrote "in most cases", because sometimes it didn't help too. In that case: Magical SysRQ.
Back to top
View user's profile Send private message
Xarthisius
Retired Dev
Retired Dev


Joined: 12 Oct 2007
Posts: 33
Location: Toruń, Poland

PostPosted: Sat Mar 21, 2009 2:23 pm    Post subject: Reply with quote

It's baselayout bug. Problem's been already mentioned at bugzilla
Temporary solution can be also found there.

Cheers,
Xarthisius
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