Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to deal with the directories that cannot be unmounted under the Linux system

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to deal with the directories that cannot be uninstalled under the Linux system. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

Background note:

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 / mnt umount2: Device or resource busy umount: / mnt: device is busy umount2: Device or resource busy umount: / 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.

This is the end of this article on "how to deal with directories that cannot be uninstalled under the Linux system". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report