49

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?

82

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

  • 1
    it took me 20 minutes trying until I've google it and found this – confiq Apr 9 '17 at 13:09
  • You save my life! – Yu Jiaao Apr 17 '18 at 1:48
14

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

  • 1
    Upvote for good life advice – antonagestam May 7 '18 at 9:36
4

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.

  • 3
    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 '16 at 6:09

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.