<p>I have an NFS-mounted directory on a Linux machine that has hung. I've tried to force an unmount, but it doesn't seem to work:</p>

<pre><code>$ umount -f /mnt/data
$ umount2: Device or resource busy
$ umount: /mnt/data: device is busy
</code></pre>

<p>If I type "<code>mount</code>", it appears that the directory is no longer mounted, but it hangs if I do "<code>ls /mnt/data</code>", and if I try to remove the mountpoint, I get:</p>

<pre><code>$ rmdir /mnt/data
rmdir: /mnt/data: Device or resource busy
</code></pre>

<p>Is there anything I can do other than reboot the machine?</p>

[{'answer_id': 40320, 'author': 'tessein', 'author_id': 3075, 'author_profile': 'https://Stackoverflow.com/users/3075', 'pm_score': 9, 'selected': True, 'text': '<p>You might try a lazy unmount:</p>\n\n<pre><code>umount -l\n</code></pre>\n'}, {'answer_id': 40331, 'author': 'Ryan Ahearn', 'author_id': 75, 'author_profile': 'https://Stackoverflow.com/users/75', 'pm_score': 4, 'selected': False, 'text': '<p>Try running</p>\n\n<pre><code>lsof | grep /mnt/data\n</code></pre>\n\n<p>That should list any process that is accessing /mnt/data that would prevent it from being unmounted.</p>\n'}, {'answer_id': 64180, 'author': 'Daniel Papasian', 'author_id': 7548, 'author_profile': 'https://Stackoverflow.com/users/7548', 'pm_score': 6, 'selected': False, 'text': "<p>If the NFS server disappeared and you can't get it back online, one trick that I use is to add an alias to the interface with the IP of the NFS server (in this example, 192.0.2.55). </p>\n\n<h2>Linux</h2>\n\n<p>The command for that is something roughly like:</p>\n\n<pre><code>ifconfig eth0:fakenfs 192.0.2.55 netmask 255.255.255.255\n</code></pre>\n\n<p>Where 192.0.2.55 is the IP of the NFS server that went away.  You should then be able to ping the address, and you should also be able to unmount the filesystem (use unmount -f).  You should then destroy the aliased interface so you no longer route traffic to the old NFS server to yourself with:</p>\n\n<pre><code>ifconfig eth0:fakenfs down\n</code></pre>\n\n<h2>FreeBSD and similar operating systems</h2>\n\n<p>The command would be something like:</p>\n\n<pre><code>ifconfig em0 alias 192.0.2.55 netmask 255.255.255.255\n</code></pre>\n\n<p>And then to remove it:</p>\n\n<pre><code>ifconfig em0 delete 192.0.2.55\n</code></pre>\n\n<p>man ifconfig(8) for more!</p>\n"}, {'answer_id': 64264, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 2, 'selected': False, 'text': '<p>Your NFS server disappeared.</p>\n\n<p>Ideally your best bet is if the NFS server comes back.</p>\n\n<p>If not, the "umount -f" should have done the trick.\nIt doesn\'t ALWAYS work, but it often will.</p>\n\n<p>If you happen to know what processes are USING the NFS filesystem,\nyou could try killing those processes and then maybe an unmount would work.</p>\n\n<p>Finally, I\'d guess you need to reboot.</p>\n\n<p>Also, DON\'T soft-mount your NFS drives.  You use hard-mounts to guarantee\nthat they worked.  That\'s necessary if you\'re doing writes.</p>\n'}, {'answer_id': 12211102, 'author': 'Dave', 'author_id': 1057407, 'author_profile': 'https://Stackoverflow.com/users/1057407', 'pm_score': 2, 'selected': False, 'text': '<p>Couldn\'t find a working answer here; but on linux you can run "umount.nfs4 /volume -f" and it definitely unmounts it.</p>\n'}, {'answer_id': 14048770, 'author': 'Daniel N.', 'author_id': 1931086, 'author_profile': 'https://Stackoverflow.com/users/1931086', 'pm_score': 4, 'selected': False, 'text': '<p>I had the same problem, and \nneither           <code>umount /path -f</code>,\nneither           <code>umount.nfs /path -f</code>,\nneither           <code>fuser -km /path</code>,\nworks</p>\n\n<p>finally I found a simple solution >.&lt;</p>\n\n<p><code>sudo /etc/init.d/nfs-common restart</code>, then lets do the simple <code>umount</code> ;-)</p>\n'}]
['https://Stackoverflow.com/questions/40317', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/742/']