Linux命令-fuser

显示设备被哪个进程占用,例如:

[root@localhost ~]# fuser -m -v /dev/sdb1
USER PID ACCESS COMMAND
/dev/sdb1: root kernel mount /data
root 1067 ..ce. redis-server
root 1085 f.c.. mysqld_safe
mysql 1450 F.ce. mysqld
root 1477 F..e. php-fpm
webPHP 1480 …e. php-fpm
webPHP 1481 …e. php-fpm

帮助信息:

[root@localhost ~]# fuser --help
Usage: fuser [-fMuvw] [-a|-s] [-4|-6] [-c|-m|-n SPACE] [-k [-i] [-SIGNAL]] NAME…
fuser -l
fuser -V
Show which processes use the named files, sockets, or filesystems.
-a,--all display unused files too
-i,--interactive ask before killing (ignored without -k)
-k,--kill kill processes accessing the named file
-l,--list-signals list available signal names
-m,--mount show all processes using the named filesystems or block device
-M,--ismountpoint fulfill request only if NAME is a mount point
-n,--namespace SPACE search in this name space (file, udp, or tcp)
-s,--silent silent operation
-SIGNAL send this signal instead of SIGKILL
-u,--user display user IDs
-v,--verbose verbose output
-w,--writeonly kill only processes with write access
-V,--version display version information
-4,--ipv4 search IPv4 sockets only
-6,--ipv6 search IPv6 sockets only
reset options
udp/tcp names: [local_port][,[rmt_host][,[rmt_port]]]