在Linux管理umount设备时,时常会遇到"device is busy", 如果umount一个文件系统碰到这种情况,并且你并没有在所需卸载的目录下。那么很可能有用户或进程正在使用那个目录。
# umount /mnt文章源自网吧系统维护-https://www.58pxe.com/7767.html
umount: /mnt: device is busy文章源自网吧系统维护-https://www.58pxe.com/7767.html
umount: /mnt: device is busy文章源自网吧系统维护-https://www.58pxe.com/7767.html
那么必须用fuser命令来查看process ID和进程的拥有者,比如:文章源自网吧系统维护-https://www.58pxe.com/7767.html
# fuser -mu /mnt文章源自网吧系统维护-https://www.58pxe.com/7767.html
/mnt: 25781c(root)文章源自网吧系统维护-https://www.58pxe.com/7767.html
# kill -9 25781文章源自网吧系统维护-https://www.58pxe.com/7767.html
# umount /mnt文章源自网吧系统维护-https://www.58pxe.com/7767.html
像下面这种情况,就代表rhythmbox用户在使用那个目录。然后也可以用fuser -ck /dev/sdc1来杀进程。文章源自网吧系统维护-https://www.58pxe.com/7767.html
# fuser -m /dev/sdc1文章源自网吧系统维护-https://www.58pxe.com/7767.html
/dev/sdc1: 538文章源自网吧系统维护-https://www.58pxe.com/7767.html
# ps auxw|grep 538文章源自网吧系统维护-https://www.58pxe.com/7767.html
donncha 538 0.4 2.7 219212 56792 SLl Feb11 11:25 rhythmbox文章源自网吧系统维护-https://www.58pxe.com/7767.html
如果所有这些努力还不奏效,杀掉该进程后,那么这个时候可能需要加-f -l参数,强制卸载文章源自网吧系统维护-https://www.58pxe.com/7767.html
# umount -f -l /mnt文章源自网吧系统维护-https://www.58pxe.com/7767.html
NOTE:文章源自网吧系统维护-https://www.58pxe.com/7767.html
可用下面的命令来检查SATA硬盘的坏块。文章源自网吧系统维护-https://www.58pxe.com/7767.html
# badblocks -v /dev/sda文章源自网吧系统维护-https://www.58pxe.com/7767.html
# badblocks -v /dev/sdb文章源自网吧系统维护-https://www.58pxe.com/7767.html
# badblocks -v /dev/mapper/vgosi-lvol1文章源自网吧系统维护-https://www.58pxe.com/7767.html
Checking blocks 0 to 10477568
Checking for bad blocks (read-only test): done
Pass completed, 0 bad blocks found.
评论