umount /mnt/cdrom

时间:2023-12-15 18:41:38

这是因为有程序正在访问这个设备,最简单的办法就是让访问该设备的程序退出以后再umount。可能有时候用户搞不清除究竟是什么程序在访问设备,如果用户不急着umount,则可以用:

umount -l /mnt/hda5

来卸载设备。选项 –l 并不是马上umount,而是在该目录空闲后再umount。还可以先用命令 ps aux 来查看占用设备的程序PID,然后用命令kill来杀死占用设备的进程,这样就umount的非常放心了。另外一个非常管用的工具

假设无法卸载的设备为/dsg,运行下列命令即可:

$ fuser -m -v /dsg

Usage: fuser [ -a | -s | -c ] [ -n SPACE ] [ -SIGNAL ] [ -kimuv ] NAME...
[ - ] [ -n SPACE ] [ -SIGNAL ] [ -kimuv ] NAME...
fuser -l
fuser -V
Show which processes use the named files, sockets, or filesystems

-a display unused files too
-c mounted FS
-f silently ignored (for POSIX compatibility)
-i ask before killing (ignored without -k)
-k kill processes accessing the named file
-l list available signal names
-m show all processes using the named filesystems
-n SPACE search in this name space (file, udp, or tcp)
-s silent operation
-SIGNAL send this signal instead of SIGKILL
-u display user IDs
-v verbose output
-V display version information
-4 search IPv4 sockets only
-6 search IPv6 sockets only
- reset options

udp/tcp names: [local_port][,[rmt_host][,[rmt_port]]]

-m参数表明指定的路径是一个挂载点显示所有使用指定文件系统的进程,后面可以跟挂载点,-v参数给出详细的输出

用下面这个命令可以将占用目录/dsg所有进程给kill掉:

$ fuser -m –k /dsg

这样umount: /dsg: device is busy这个问题就可以解决.