Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have this fstab entry:

machine.local:/srv/files /res/files nfs defaults 0 0

It was working great until machine.local dropped the connection momentarily. Now, the share isn't accessible. df, umount /res/files, ls /res all hang forever.

What should I do, short of a reboot?

share|improve this question
add comment

3 Answers

up vote 4 down vote accepted

NFS really ought to reconnect once the NFS server is back up. It may take a few minutes (it needs to notice the timeout). The timeo option lets you change how long the timeout takes.

umount -f /res/files will probably unmount the share (and kill all the processes waiting on it), if you try it a few times.

On older kernels, if you have the share mounted with intr, you can kill the waiting processes. On newer kernels (2.6.25+), you can kill -9 them.

NFS client options are documented in the nfs(5) manpage.

Note: Some versions of umount have a bug where they try to stat the filesystem before unmounting it. If so, you'll need a trivial C program like this:

#include <sys/mount.h>
int main() {
    const char p[] = "/res/files";
    umount2(p, MNT_FORCE);
    umount2(p, MNT_FORCE);
    return 0;
}
share|improve this answer
add comment

I needed to do a lazy umount:

umount -l /res/files
mount /res/files

https://bbs.archlinux.org/viewtopic.php?id=17567

share|improve this answer
    
That actually leaves it mounted, and leaves your hung programs hung. Of course, it'll finally finish unmounting once it reconnects to the NFS server... –  derobert May 31 '13 at 15:14
    
I should add that I immediately mount the share again. In fact, I will add that. –  Matt Alexander May 31 '13 at 15:16
    
A lazy unmount just removes it from the mountpount, it's still actually mounted. Just not visible anymore. So, when you remount it, you have it mounted twice at that point. That's likely not really a problem, just something to be aware of. –  derobert May 31 '13 at 15:21
    
How can I detect that second mount? df shows one. –  Matt Alexander May 31 '13 at 16:48
add comment

Assuming this is a system that supports it, you could try force-unmounting the filesystem and then re-mounting:

umount -f /res/files
mount /res/files
share|improve this answer
    
I get umount.nfs4: /res/files: device is busy, and df is still hanging. –  Matt Alexander May 31 '13 at 15:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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