Forcibly Unmounting NFS Filesystems

forcibly unmounting nfs filesystems
available solutions
5
available
solutions
While HP will not offer an officially supported forcible unmount solution for some time,
there are several steps that you can take today to work around this problem. All of the
solutions documented in this section should work on currently supported HP-UX 11.0 or
11i systems.
wait and try
umount(1M) again
As stated earlier, the primary reason why NFS filesystems are considered “busy” and
cannot be successfully unmounted is because client-side processes hold NFS resources in
the specified filesystem and must relinquish these resources before the filesystem can be
unmounted.
If an initial unmount attempt fails for an NFS filesystem, it is always a good idea to wait
for a brief period of time (typically a few minutes) and try unmounting the filesystem
again. It is always possible that a subsequent unmount command will succeed – if the
processes waiting on the down NFS server either timeout or give up waiting for the server
to recover and release the NFS resources they were holding. Also, during this unmount
interval there is the possibility that buffer cache pages, memory mapped file pages, or
page cache memory pages associated with the NFS filesystem in question could be freed
and invalidated, thus allowing the filesystem to be unmounted successfully.
Of course, if the applications holding the NFS resources are not designed to timeout and
give up you could find yourself waiting forever for something that won’t happen.
kill any processes
accessing the nfs
filesystem
While certain processes holding NFS resources sleep at an uninterruptible level in the
kernel and cannot receive signals, many times the processes that are keeping an NFS
filesystem busy can be successfully killed, thus allowing the filesystem to be unmounted.
The easiest way to determine which processes are keeping an NFS filesystem busy, and
whether these processes can be successfully killed, is to use the fuser(1M) command.
The fuser(1M) command, when issued against a file, lists the process IDs of any processes
that have the specified file open. When issued against a filesystem, fuser(1M) lists the
process IDs of all processes that currently have open files residing in the specified
filesystem. fuser(1M) can also be used to programmatically send kill signals to these
identified processes.
Figure 1 on page 6 shows an example of using the fuser(1M) command to successfully
identify and kill the processes holding an NFS filesystem busy. The various steps
illustrated in Figure 1 include:
1. Attempt to unmount the NFS filesystem via the umount(1M) command
2. Use the fuser(1M) command to identify the process IDs of those processes that
have files open in the specified filesystem
3. Use the ps(1) command to view the offending processes. The “-p” option
instructs ps(1) to only return information for the specified process IDs.