View previous topic :: View next topic |
Author |
Message |
hoacker Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/116941386646b8bb56ca430.png)
Joined: 04 Aug 2007 Posts: 505 Location: Bürstadt, Germany
|
Posted: Tue Sep 30, 2008 5:52 pm Post subject: [solved] How? unmount NFS when connection lost |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
peaceful Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/gallery/Zelda/Zelda_-_Link.jpg)
Joined: 06 Jun 2003 Posts: 287 Location: Utah
|
Posted: Thu Oct 02, 2008 8:26 pm Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
hoacker Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/116941386646b8bb56ca430.png)
Joined: 04 Aug 2007 Posts: 505 Location: Bürstadt, Germany
|
Posted: Thu Oct 02, 2008 8:54 pm Post subject: |
|
|
Yes, I know the "force" option, but how "force" unmount during the shutdown process? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
peaceful Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/gallery/Zelda/Zelda_-_Link.jpg)
Joined: 06 Jun 2003 Posts: 287 Location: Utah
|
Posted: Thu Oct 02, 2008 8:58 pm Post subject: |
|
|
Add "umount -f /your/mounted/directory" to /etc/conf.d/local.stop |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
hoacker Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/116941386646b8bb56ca430.png)
Joined: 04 Aug 2007 Posts: 505 Location: Bürstadt, Germany
|
Posted: Thu Oct 02, 2008 9:09 pm Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
peaceful Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/gallery/Zelda/Zelda_-_Link.jpg)
Joined: 06 Jun 2003 Posts: 287 Location: Utah
|
Posted: Thu Oct 02, 2008 9:24 pm Post subject: |
|
|
local.start is executed after normal startup. local.stop is executed before normal shutdown. They're pretty useful in cases like this. ![Smile :)](images/smiles/icon_smile.gif) |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
arth1 n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 29 Nov 2006 Posts: 24
|
Posted: Sat Oct 04, 2008 3:48 pm Post subject: Re: How? unmount NFS when connection lost (during shutdow) |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
hoacker Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/116941386646b8bb56ca430.png)
Joined: 04 Aug 2007 Posts: 505 Location: Bürstadt, Germany
|
Posted: Sat Oct 04, 2008 4:00 pm Post subject: Re: How? unmount NFS when connection lost (during shutdow) |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
hoacker Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/116941386646b8bb56ca430.png)
Joined: 04 Aug 2007 Posts: 505 Location: Bürstadt, Germany
|
Posted: Sat Oct 04, 2008 6:53 pm Post subject: Re: How? unmount NFS when connection lost (during shutdow) |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
chris... Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
Joined: 26 Sep 2006 Posts: 179 Location: Melbourne, AU
|
Posted: Fri Mar 20, 2009 10:56 pm Post subject: |
|
|
Code: | umount -f /directory/ |
doesnt work for me |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
musv Advocate
![Advocate Advocate](/images/ranks/rank-G-1-advocate.gif)
![](images/avatars/17022956523ec2f01a46f03.jpg)
Joined: 01 Dec 2002 Posts: 3369 Location: de
|
Posted: Sat Mar 21, 2009 12:15 am Post subject: |
|
|
I had a lot of problems with umount -f. In most cases umount -l did a better job for me. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
chris... Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
Joined: 26 Sep 2006 Posts: 179 Location: Melbourne, AU
|
Posted: Sat Mar 21, 2009 3:12 am Post subject: |
|
|
most cases? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
musv Advocate
![Advocate Advocate](/images/ranks/rank-G-1-advocate.gif)
![](images/avatars/17022956523ec2f01a46f03.jpg)
Joined: 01 Dec 2002 Posts: 3369 Location: de
|
Posted: Sat Mar 21, 2009 11:26 am Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
Xarthisius Retired Dev
![Retired Dev Retired Dev](/images/ranks/rank-retired.gif)
Joined: 12 Oct 2007 Posts: 33 Location: Toruń, Poland
|
Posted: Sat Mar 21, 2009 2:23 pm Post subject: |
|
|
It's baselayout bug. Problem's been already mentioned at bugzilla
Temporary solution can be also found there.
Cheers,
Xarthisius |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|