Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Force unmount of NFS-mounted directory [closed]

People also ask

How do I clear stale in NFS mounts?

How do I fix this problem? First command (umount) forcefully unmount a disk partition /mnt/local (NFS). (b) Or try to mount NFS directory with the noac option.

How do you unmount a stale file handle?

Specify the -f option to the umount [59] command to forcibly unmount a filesystem. This should be done only as a last resort, since using this option can cause data loss for open files.


You might try a lazy unmount:

umount -l

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).

Linux

The command for that is something roughly like:

ifconfig eth0:fakenfs 192.0.2.55 netmask 255.255.255.255

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:

ifconfig eth0:fakenfs down

FreeBSD and similar operating systems

The command would be something like:

ifconfig em0 alias 192.0.2.55 netmask 255.255.255.255

And then to remove it:

ifconfig em0 delete 192.0.2.55

man ifconfig(8) for more!


Try running

lsof | grep /mnt/data

That should list any process that is accessing /mnt/data that would prevent it from being unmounted.


I had the same problem, and neither umount /path -f, neither umount.nfs /path -f, neither fuser -km /path, works

finally I found a simple solution >.<

sudo /etc/init.d/nfs-common restart, then lets do the simple umount ;-)