Get the App
SLTechnology News&Howtos  ›  Development  › 

What is the solution of unable to uninstall and mount in Linux system

Shulou Source: shulou.com Published: 2022-06-02 00:33:23 10月19日 Update

This article shows you what is the solution that can not be uninstalled in Linux system. The content is concise and easy to understand, and it will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

In our daily operation and maintenance, we often encounter operations such as disk expansion, unmounting, mounting, and so on, but sometimes the applications running on this system do not stop or other OPS colleagues are operating this directory, so we cannot directly uninstall it by umount at this time, so today we will share with you how to deal with this problem reasonably.

Phenomenon description: here we need to uninstall the / mnt directory, as shown in the following figure:

After executing the uninstall command: umount / mnt, it is found that the uninstall cannot be done, and the resource is prompted to be occupied, as shown in the following figure:

As we have seen above, the prompt is occupied and cannot be uninstalled. How to deal with it? The method is simple, you can use forced uninstall, and the command is as follows:

[root@docker /] # umount-f / mntumount2: Device or resource busyumount: / mnt: device is busyumount2: Device or resource busyumount: / mnt: device is busy

The-f parameter is for forced unloading, and here we also found that the forced unloading used above did not take effect, or if an error was reported, what should we do? Don't worry, look below!

Using the fuser command, first confirm which processes are occupying the directory

[root@docker /] # fuser-cu / mnt / mnt: 1112c (java)

The above view shows that the java process with a pid of 1112 is currently occupying this directory, so it cannot be uninstalled.

So after we have confirmed which process occupies this directory, we can kill the process.

There are two ways to kill the process:

The first is the direct command we usually use: kill-9 1120.

The second is to use fuser-ck / mnt

[root@docker /] # fuser-ck / mnt/mnt: 1120c

When we need to know which directory is occupied by which process, we can also use the lsof command to check it.

The above content is what is the solution that can not uninstall and mount in Linux system. Have you learned the knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Tags: Directory process command system that is compulsion method content skill method time knowledge hint usual anxious concise concise parameter colleague what to do Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi NVidia Xiaomi vpn Shulou Tech Info