In the process of attaching the data disk, we should see that the directory that was originally attached needs to be uninstalled first. The umount command is generally used here to unload. However, sometimes the "target is busy" error occurs. The basic problem is that the directory to be uninstalled is still running software.
The solution is to stop the currently running software. Here are some solutions that we can refer to.
1. Processing by lsof command
Jiang usually checks whether the running software is bound to the corresponding directory through the lsof command.
lsof /www/
For example, I check whether there is software running in the www directory. If there is, we can stop the corresponding software, such as php, mysql, and so on, corresponding to the PID.
Only if lsof detects that no software is running, we can go to umount to uninstall and report no problems.
2. Processing with fuser command
You need to install component support before using the fuser command.
yum install psmisc -y
Then you need to check whether there are running processes like lsof.
fuser -mv /www/
If any, stop the process.
fuser -kv /www/
One command deletes all processes.
In this way, we can detect and delete the occupied process through two methods, and then unload and mount it.
Follow the public account "Chiang Kai shek's circle of friends"
Get more new knowledge about station building, operation and maintenance!
Internet entrepreneurship, cutting-edge technology