Linux umount: /nft_data: device is busy

At 2011-07-22

转载请注明文章转载自:Dbabc.Net [http://dbabc.net]
本文链接:http://dbabc.net/archives/2011/07/22/linux-umount-nft_data-device-is-busy.shtml

今天在卸载nfs目录的时候出现 device is busy,今天总结一下。
当umount的时候出现device is busy肯定是其他程序正在使用此目录。有两种方法可以解决,一是找到正在使用要卸载的目录的程序将其kill掉,二是使用umount –l 当目录不繁忙时, 直接卸载。
可是如何找到哪个程序正式使用此目录呢,可以使用fuser来搞定,来我们看一下fuser,以下是通过man fuser得到的部分信息:

[root@dbabc]#man fuser
NAME
fuser - identify processes using files or sockets

SYNOPSIS
fuser [-a|-s] [-4|-6] [-n space] [-signal] [-kimuv] name ...
fuser -l
fuser -V

使用fuser -m /nfs_data,查看那个程序正在使用此目录

[root@dbabc]#fuser -m /nfs_data
/db_bak/:            11212c

就代表是 process 11212(pid) 有使用到此目录, 后面 c 代表的意思可参考下述:

c: current directory.
e: executable being run.
f: open file. f is omitted in default display mode.
F: open file for writing. F is omitted in default display mode.
r: root directory.
m: mmap'ed file or shared library.

在kill之前最好通过 ps aux|grep 11212是什么程序,

也可以使用 fuser -m -v -i -k /mnt_dir

[root@dbabc]#fuser -m -v -i -k /db_bak/

USER        PID ACCESS COMMAND
/db_bak/             root      11212...c..  bash
Kill process 11212? (y/N)

然后输入y直接就将11212进程kill掉。然后执行umount命令进行卸载。

以上是通过强制kill掉进程的方式解决,这样有一定的危险性,如果你觉得不放心的话,可以使用 umount -l选项来执行卸载。

-l     Lazy  unmount. Detach the filesystem from the filesystem hierarchy now, and cleanup all references
to the filesystem as soon as it is not busy anymore.  (Requires kernel 2.4.11 or later.)

当需卸载文件系统的引用不繁忙时直接卸载。

fuser 和umount的详细使用方法可以通过man来查看,以此为记。

无觅相关文章插件,快速提升流量

Copyright © Dbabc.Net All Rights Reserved. 本站内容仅代表个人观点, 与其他任何组织或公司无关

-The End-
  • 暂无相关日志

发表评论


*

为你保密









Copyright © Dbabc.Net All Rights Reserved. 本站内容仅代表个人观点, 与其他任何组织或公司无关

Powered by Wordpress and Theme by WPYOU