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?
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
try
sudo umount -l {mountPoint}
to do a "lazy unmount". Lets you move on with your life without waiting for the plumber to arrive.In my case where
umount -f
did not work,umount -fr
worked.-r
argument remounts as read-only and then unmounts the folder.In case
umount -f -l /mnt/myfolder
doesn't workservice nfs restart
(or it's equivalent on your linux) might.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.
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