Quick ?s
Cheat Sheets
Man Pages
The Lynx

How do I force an NFS mount to umount?

Category: Linux

When unmounting an NFS mount any activity on the mount can cause the device to be listed as busy.

First, of course, try to unmount:

unmount /foo

If it responds as busy, use "lsof" to look for processes accessing files in the mount:

lsof | grep REG | grep /foo

Stop or kill any processes or shells that are currently in that file. "cwd" means someone is currently in that directory. It might be you.

There is a program called fuser that can be used to check what is accessing a current directory. Again, stop any processes:

fuser -mv /foo

Be careful with fuser as some of the command line options will kill everthing interacting with a directory. Misfiring that on root would create quite a mess.

Try to unmount again. If that doesn't work try to force the unmount:

unmount --force /foo

If this is refused again it might be two rare items.

#1 - if the mount is in autofs it will be mounted regularly. Temporarily stop autofs and try to unmount and then unmount with force:

service autofs stop
unmount /foo

#2 - If that doesn't work, check your mount table in fstab or run "mount -v" and look at what is mounted. If you have mounted an NFS mount within the NFS mount point you are trying to unmount, you will need to unmount the inner mount point first.

The final option is to admit defeat, comment the entry out of /etc/fstab and reboot the box to clear all mounts.

Yals.net is © 1999-2009 Crescendo Communications
Sharing tech info on the web for more than a decade!
This page was generated Sat May 2 21:36:43 2009