之前将一块硬盘挂载到某个目录下,但是现在我想卸载掉这块硬盘,无论如何都umount不了,有些同学可能说需要加上 -f 参数强制卸载,理论上是可以的,但是在我这里依然不起作用,比如:
[[email protected]:vg_adn_clickhouseTest_1ubuntu:: ~]#umount -f /data2 umount: /data2: target is busy.
我是把一块2T的硬盘挂载到/data2目录下了,可是现在就是卸载不了,说是设备忙,仔细分析一下可以得出应该是某些应用程序的进程占用了这块分区/data2 。应用程序一直在跑着,所以我们无法卸载这块硬盘。解决的方法就是找出哪个进程在占用这块硬盘。那我们知道一块硬盘一般上都是关联至某一个目录下的。所以我们就去找这个目录被哪些进程所占用。使用命令 lsof 即可
[[email protected]:vg_adn_clickhouseTest_2ubuntu:172.31.19.193 ~]#lsof /data2 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME clickhous 31721 clickhouse 7wW REG 253,0 59 45088774 /data2/clickhouse/status [[email protected]:vg_adn_clickhouseTest_2ubuntu:172.31.19.193 ~]#kill -9 31721 [[email protected]:vg_adn_clickhouseTest_2ubuntu:172.31.19.193 ~]#service clickhouse-server status ● clickhouse-server.service - ClickHouse Server (analytic DBMS for big data) Loaded: loaded (/etc/systemd/system/clickhouse-server.service; enabled; vendor preset: enabled) Active: activating (auto-restart) (Result: signal) since Wed 2019-01-16 10:51:32 UTC; 11s ago Process: 31721 ExecStart=/usr/bin/clickhouse-server --config=/etc/clickhouse-server/config.xml (code=killed, signal=KILL) Process: 31715 ExecStartPre=/bin/chown clickhouse:clickhouse -R /etc/clickhouse-server (code=exited, status=0/SUCCESS) Process: 31713 ExecStartPre=/usr/bin/chown clickhouse:clickhouse -R /etc/clickhouse-server (code=exited, status=0/SUCCESS) Main PID: 31721 (code=killed, signal=KILL) Jan 16 10:51:32 ip-172-31-19-193 systemd[1]: clickhouse-server.service: Failed with result ‘signal‘.
现在我们找到原来是clickhouse程序再占用这块磁盘,因此我们卸载不了。事实上,lsof命令后面也可以跟上lvm的名字也是可以查出来的。
原文地址:https://www.cnblogs.com/FengGeBlog/p/10279051.html
时间: 2024-10-10 14:04:02