在Linux管理umount設(shè)備時,時常會遇到"device is busy", 如果umount一個文件系統(tǒng)碰到這種情況,并且你并沒有在所需卸載的目錄下。那么很可能有用戶或進程正在使用那個目錄。
# umount /mnt文章源自網(wǎng)吧系統(tǒng)維護-http://www.hvig.cn/7767.html
umount: /mnt: device is busy文章源自網(wǎng)吧系統(tǒng)維護-http://www.hvig.cn/7767.html
umount: /mnt: device is busy文章源自網(wǎng)吧系統(tǒng)維護-http://www.hvig.cn/7767.html
那么必須用fuser命令來查看process ID和進程的擁有者,比如:文章源自網(wǎng)吧系統(tǒng)維護-http://www.hvig.cn/7767.html
# fuser -mu /mnt文章源自網(wǎng)吧系統(tǒng)維護-http://www.hvig.cn/7767.html
/mnt: 25781c(root)文章源自網(wǎng)吧系統(tǒng)維護-http://www.hvig.cn/7767.html
# kill -9 25781文章源自網(wǎng)吧系統(tǒng)維護-http://www.hvig.cn/7767.html
# umount /mnt文章源自網(wǎng)吧系統(tǒng)維護-http://www.hvig.cn/7767.html
像下面這種情況,就代表rhythmbox用戶在使用那個目錄。然后也可以用fuser -ck /dev/sdc1來殺進程。文章源自網(wǎng)吧系統(tǒng)維護-http://www.hvig.cn/7767.html
# fuser -m /dev/sdc1文章源自網(wǎng)吧系統(tǒng)維護-http://www.hvig.cn/7767.html
/dev/sdc1: 538文章源自網(wǎng)吧系統(tǒng)維護-http://www.hvig.cn/7767.html
# ps auxw|grep 538文章源自網(wǎng)吧系統(tǒng)維護-http://www.hvig.cn/7767.html
donncha 538 0.4 2.7 219212 56792 SLl Feb11 11:25 rhythmbox文章源自網(wǎng)吧系統(tǒng)維護-http://www.hvig.cn/7767.html
如果所有這些努力還不奏效,殺掉該進程后,那么這個時候可能需要加-f -l參數(shù),強制卸載文章源自網(wǎng)吧系統(tǒng)維護-http://www.hvig.cn/7767.html
# umount -f -l /mnt文章源自網(wǎng)吧系統(tǒng)維護-http://www.hvig.cn/7767.html
NOTE:文章源自網(wǎng)吧系統(tǒng)維護-http://www.hvig.cn/7767.html
可用下面的命令來檢查SATA硬盤的壞塊。文章源自網(wǎng)吧系統(tǒng)維護-http://www.hvig.cn/7767.html
# badblocks -v /dev/sda文章源自網(wǎng)吧系統(tǒng)維護-http://www.hvig.cn/7767.html
# badblocks -v /dev/sdb文章源自網(wǎng)吧系統(tǒng)維護-http://www.hvig.cn/7767.html
# badblocks -v /dev/mapper/vgosi-lvol1文章源自網(wǎng)吧系統(tǒng)維護-http://www.hvig.cn/7767.html
Checking blocks 0 to 10477568
Checking for bad blocks (read-only test): done
Pass completed, 0 bad blocks found.


評論