Linux使用fuser命令找出訪問文件系統的進程
fuser用于標識訪問文件或socket的進程信息。下面以經常會遇到的不能卸載光驅為例,討論fuser的用法:
1).卸載光驅文件系統:
[root@vserver01 ~]# umount /mnt
umount: /mnt: device is busy
umount: /mnt: device is busy
2).找出依然在訪問該文件系統的進程號:
[root@vserver01 ~]# fuser -c /mnt
/mnt: 2563c
[root@vserver01 ~]# ps -ef | grep 2563
root 2563 2499 0 15:19 tty1 00:00:00 -bash
root 5462 5383 0 16:11 pts/0 00:00:00 grep 2563
3).kill進程:
[root@vserver01 ~]# kill -9 2563
[root@vserver01 ~]# ps -ef | grep 2563
root 5488 5383 0 16:11 pts/0 00:00:00 grep 2563
4).成功卸載光驅文件系統:
[root@vserver01 ~]# umount /mnt
[root@vserver01 ~]#
posted on 2014-11-27 12:01 順其自然EVO 閱讀(593) 評論(0) 編輯 收藏 所屬分類: 測試學習專欄