106

I am mounting a NFS-folder from a server to my laptop.

Unfortunately, the server goes off sometimes... The problem is, that I cannot unmount the "dead" NFS-folder. On the command-line, I get "device is busy", and via nautilus it crashes my current session.

Is there any way to unmount a NFS-folder when the server is off?

2

6 Answers 6

211

You can use umount -f -l /mnt/myfolder, and that will fix the problem.

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

  • -l – Lazy unmount. Detach the filesystem from the filesystem hierarchy now, and cleanup all references to the filesystem as soon as it is not busy anymore. (Requires kernel 2.4.11 or later.)

Source:Linux Complete Command Reference

0
25

try sudo umount -l {mountPoint} to do a "lazy unmount". Lets you move on with your life without waiting for the plumber to arrive.

0
6

In my case where umount -f did not work, umount -fr worked. -r argument remounts as read-only and then unmounts the folder.

2

In case umount -f -l /mnt/myfolder doesn't work service nfs restart (or it's equivalent on your linux) might.

1
  • 4
    The problem with this is if you have several nfs mounted paths from different servers and you don't want to drop other mount points which would affect other services.
    – Efren
    May 16, 2016 at 6:09
2

For me, neither umount, nor service restart will work. Just reboot. Even with a new system, NFS implementation seems to still have that old issue. So, just reboot.

1
0

I noticed something when trying to unmount directories for NFS servers that go offline.

My first instinct is to unmount lowest subdirectories first and then work my way up to the top of the directory tree. However, unmounting subdirectories by using --force and --lazy failed and resulted in a long timeout. What finally worked for me was when I used --force and --lazy at the top level, as in:

umount --lazy --force /net/machine

Don't first try to unmount the lower directories, such as:

umount --lazy --force /net/machine/subdir

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .