Umounting an NFS-mounted share after connection is lost?

Rick Macklem rmacklem at uoguelph.ca
Tue Oct 29 04:49:46 UTC 2019


Alan Somers wrote:

>On Mon, Oct 28, 2019 at 8:53 PM Thomas Mueller <mueller6722 at twc.com> >wrote:
>
>> How do you umount a file system that has been mounted with mount_nfs when
>> the connection is lost?
>>
>> Server can crash, cable modem could quit and not hold power, or a change
>> in cable modem or router could change 192.168.0.1 to 192.168.1.1 .
>>
>> Running umount hangs the terminal session.  Is there a way out short of
>> rebooting?
# umount -N <mount_path>
- You will lose any outstanding file changes that haven't yet been sent to the
  server. (It may take a couple of minutes to complete.)

>>
>> In the case of a server crash, I could reboot the server, mount the
>> desired partition, run "/etc/rc.d/mountd restart", and be good again.
>>
>> But last weekend, the cable modem-router lost power, could be restored by
>> unplugging and replugging, but would only hold for maybe a half minute
>> before going dark again.
>>
>> Charter Spectrum support told me that I could get a free replacement,
>> which I did, cable modem and router were two separate pieces this time.
>>
>> I was able to install the equipment successfully but noticed that the
>> router address was 192.168.1.1 rather than the old 192.168.0.1 .
>>
>> I was left with /homeawayfromhome that I couldn't unmount except by
>> rebooting.
>>
>> Tom
>>
>
>If you mount your NFS share with the -o intr option, then you can forcibly
>unmount it when the server is unavailable.  However, that's not generally
>recommended.  A lot of applications can't gracefully handle an error in
>read(2) or write(2).
Actually "-o intr" allows a process stuck on a wedged NFS server to be killed
with <ctrl>C. 

To force the dismount, you need the "-N" option on the umount command,
as noted above. ("-f" won't work reliably for this)

And as Alan noted, a lot of applications won't understand the EINTR failure
for a read/write and any cached writes won't get written to the server and
will be lost, but at least you don't need to reboot.

rick

-Alan
_______________________________________________
freebsd-net at freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "freebsd-net-unsubscribe at freebsd.org"


More information about the freebsd-net mailing list