您的位置:首页 > 运维架构 > Shell

some shell command that may help when umounting a usb device

2008-06-14 15:16 435 查看
Hi, I am attempting to unmount my NTFS partition in /media/disk and I am unable to do so. When I right click on the "disk" icon on my desktop and click unmount, i get an error saying:

Code:
Cannot unmount volume.
An application is preventing the volume from being unmounted.


When I try to manually unmount the volume using umount /media/disk I get the following:

Code:
root@pavel-laptop:/media/disk# umount /media/disk
umount: /media/disk: device is busy
umount: /media/disk: device is busy


Finally when I try to see if anything is using the volume I try:

Code:
root@pavel-laptop:/media/disk# ps x | grep /media/disk
12425 pts/0    R+     0:00 grep /media/disk


Where the pid changes every time i run the command. and lastly this is the output of lsof:

Code:
root@pavel-laptop:/media/disk# lsof /media/disk
COMMAND   PID USER   FD   TYPE DEVICE SIZE NODE NAME
bash     8239 root  cwd    DIR    3,1 4096    5 /media/disk
lsof    12450 root  cwd    DIR    3,1 4096    5 /media/disk
lsof    12451 root  cwd    DIR    3,1 4096    5 /media/disk


the above details is from http://ubuntuforums.org/showthread.php?t=467259 try to close the applications that are accessing the device. you can also know which applications are using the device by doing

Code:
fuser /dev/device


where device is the node name of the device. close the applications then try to unmount the device. you can mount it manually too by doing

Code:
umount /dev/device


The above details is from http://www.linuxquestions.org/questions/mepis-64/unable-to-unmount-usb-device-467730/
A really useful tool for discovering what’s holding open a device you want to unmount
is the lsof command. Type lsof with the name of the partition you want to unmount
(such as lsof /mnt/floppy). The output shows you what commands are holding files open on that
partition.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐