Home > netapp > Tips and tricks for unmounting an Network File System (NFS) mount on a UNIX or Linux client?

Tips and tricks for unmounting an Network File System (NFS) mount on a UNIX or Linux client?

If your UNIX or Linux clients cannot unmount an NFS mount from a filer……

One of the following errors occur:

nfs umount:variable: is busy
umount: warning: /variable not in mnttab
unmounting NFS filesystems: Cannot MOUNTPROG RPC: RPC: Program not registered
umount: Permission denied
umount: Device busy

Level 1 Options:

    • /etc/init.d/nscd stop

NSCD caches name service lookups. If the NFS mount in question is mounted via name this can help. The specific command will stop the nscd daemon. Just like the nfsd daemon, once it is stopped, you will want to restart it using nscd start when ready to resume normal operations.

    • /etc/init.d/autofs stop

Autofs invokes the automounter which is used with applications like NIS. This script (with the stop option) will stop the automounter. As always you would want to restart the automounter using autofs start when ready to resume normal operations.

Level 2 Options:

    • umount /share or umount -f /share

This command unmounts the specified file system. The use of the -f flag attempts to forcibly unmount the file system.

Note:
Make sure you are not in the directory when trying to unmount it.

    • fuser -mk /share

This command will displays the PIDs of processes using the specified NFS mount. The -mk flags kills all processes accessing the file system /share in any way.

Note: 
This functionality is not available under SunOS. SunOS supports fuser -ck /mount_point which should kill all processes accessing the files under /mount_point.

Some times, even though fuser does not report any processes, the file system still cannot be unmounted. One way to find out if there are still open files under /mount_point is to use lsof command.

If lsof is installed, use lsof /mount_point to find out which processes have open files under /mount_point, then kill these processes.

Level 3 Options:

    • /etc/init.d/nfs.client stop — Solaris 5.X, most UNIX and Linux variants.

This command runs the start and stop script that controls the nfsd daemon. The nfs.client script has at least two options, stop and start. Once you have stopped the daemon, you will want to restart it using nfs.client start when ready to resume normal operations.

    • svcadm restart nfs/client — Solaris 10 specific.

In Solaris 10 the init.d scripts have been replaced with a more robust Service Management Facility (SMF). This command performs the same function as starting and stopping the init.d/nfs.client daemon.

Level 4 Options:

When none of the previous options have succeeded, it may be necessary to perform some globally intrusive actions on the client. The command options below will do significantly more than terminate a specific NFS mount point.

    • umountall -k -h

This command will attempt to unmount all mounted file systems except the basic root file system. The use of -k -h will send the SIGKILL signal through the file system to all remote mounted file systems as seen in the/etc/mnttab.

    • killall -HUP rpc.mountd

This command will kill the mountd daemon services which are responsible for mounting and unmounting filesystems.

    • /usr/sbin/shutdown -g0 -y -i6

Rebooting; the last resort of the desperate. For most UNIX and Linux problems this is NOT required

Categories: netapp Tags: , , , ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a comment