Question & Answer
Question
How can I force an unmount of a remote filesystem?
Answer
When a mount point goes away (that is, the remote server is down), you need to unmount the filesystem.
Try the following approaches to unmount the filesystem:
- A typical unmount: umount /my_test_mountpoint
- Learn what is preventing the unmount: fuser -v -m /my_test_mountpoint
- If all else fails, perform a lazy unmount of the filesystem: umount -f -l /my_test_mountpoint
These commands are descibed below.
The typical unmount
- umount /my_test_mountpoint
If this is unsuccessful, you have several options.
The fuser command
The first is to try fuser, a command that can be used to learn about what processes are using what files or sockets. The fuser command takes as an argument either a file path, the name of a mounted filesystem, or a namespace/port combination (for example, Telnet/TCP). If the specified resource is being used, fuser displays the name of the resource along with the ID of each process accessing it, followed by a letter signifying the type of access the process has. The following is a list of possible access types:
| Access Type | Description |
| c | the process's current directory was specified |
| e | the process's executable file was specified |
| f | the process has the specified file open for reading |
| F | the process has the specified file open for writing |
| r | the process is rooted at the specified directory |
| m | the process has the specified file memory mapped or loaded as a shared library |
In the mount drive example above, if you type fuser -v -m /my_test_mountpoint, the command accepts that you are specifying a mount point or a file on that mount point (-m) and that you want verbose (-v) output which will include column headers as shown below:
- USER PID ACCESS COMMAND/my_test_mountpoint: nz 4533 ..c.. bash
In this example, the process that is accessing the mount point has a process ID of 4533.
To find out more about that process, run the command ps aux | grep 4533. However, if you just want to kill the process so you can unmount the drive, you can add -k to fuser's command line and all processes that are accessing the specified mount point will be killed. If you are unsure about killing the process without reviewing it first, you can specify -i with -k so the command prompts you to confirm before it kills each process.
Lazy unmount
If the fuser command hangs or returns unsuccessfully, perform a lazy unmount of the filesystem by entering the following command:
- umount -f -l /my_test_mountpoint
Use of the -f and -l options cause a force unmount that detaches the filesystem from the filesystem hierarchy now, and cleans up all references to the filesystem as soon as it is available.
At this point, the mount points should be unmounted entirely and without requiring a reboot.
[{"Product":{"code":"SSULQD","label":"IBM PureData System"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":null,"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"1.0.0","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]
Historical Number
NZ203052
Was this topic helpful?
Document Information
Modified date:
17 October 2019
UID
swg21575020