# umount crashed NFS-mount

## simvin76

Hello

I have mounted an NFS-share, but the NFS-server has crashed. The server will not be coming online any time soon.

How do I umount the NFS share?

Best regards

Simon

----------

## blu3bird

 *man 8 unmount wrote:*   

> -f     Force unmount (in case of an unreachable NFS system).  (Requires
> 
>               kernel 2.1.116 or later.)

 

----------

## simvin76

Sorry, should have read the man-page better.

It didn't solve my problem:

```
sargon vinde # umount -f -t nfs babylon.article19.biz:/pub

Cannot MOUNTPROG RPC: RPC: Port mapper failure - RPC: Unable to receive

umount2: Device or resource busy

umount: /pub: device is busy

Cannot MOUNTPROG RPC: RPC: Port mapper failure - RPC: Unable to receive

umount2: Device or resource busy

umount: /pub: device is busy

```

----------

## bunder

rebooting should fix it...  i know that doesn't sound like a good thing to do, but in some cases, its the only thing you can do.  or you can keep mashing umount -f and hoping that it will work over time, because i've seen that happen too.

cheers

----------

## simvin76

 *bunder wrote:*   

> rebooting should fix it...  i know that doesn't sound like a good thing to do, but in some cases, its the only thing you can do.  or you can keep mashing umount -f and hoping that it will work over time, because i've seen that happen too.
> 
> cheers

 

This has happened before, and rebooting didn't fix it. The opposite in fact. The shutdown script waited for umount to finish, which didn't happen. sshd had already been stopped so I couldn´t log in and do anything. The reboot continued when I finally got the other server online and nfs could umount.

My big problem is that both boxes are 1000 km away so I can't do anything physical to them. The reason I want to umount is just so I can do a reboot in case I would need to do it.

/simon

----------

## bunder

you can always try a lazy umount (-f -l -a -t nfs)

that should make the system "think" its unmounted.

cheers

----------

## simvin76

 *bunder wrote:*   

> you can always try a lazy umount (-f -l -a -t nfs)
> 
> that should make the system "think" its unmounted.
> 
> cheers

 umount -f -l -t nfs babylon.article19.biz:/pub worked.

Thank you

/Simon

----------

## Malvineous

 *simvin76 wrote:*   

> 
> 
> It didn't solve my problem:
> 
> ```
> ...

 

The "device is busy" error means you've got programs/shells with their current working directories inside the mountpoint.  You can't "cd /mnt/cdrom ; umount /mnt/cdrom" for the same reason, so you need to close any program that's using the directory.

Once you've done that umount -f usually works, sometimes you have to do it a few times.

IMHO a better long-term solution for this type of problem is to mount all NFS mounts with the "soft" option, and use the "timeo" option to set a sane timeout.  This will allow things to continue after a while if the server ever goes away.  The default is "hard", which will wait forever for the server to come back online as you've discovered.

----------

## Hu

Another option is to use hard,intr.  According to the documentation, this will make programs wait forever, but they will be interruptible, so you can kill them or cause them to awaken with an EINTR.  This might be useful if you usually want to wait, but still need to avoid the problem seen here when the NFS server will be down for days or weeks.

----------

