List Open Files
If you try to unmount a partition and get a message like this:
# umount /media/usbdisk/
umount: /media/usbdisk: device is busy
use the lsof command to find out what programs are using what files:
# lsof /media/usbdisk/
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
bash 6925 root cwd DIR 8,17 4096 1 /media/usbdisk/
xmms 6979 root cwd DIR 8,17 4096 1 /media/usbdisk/
This shows that the programs bash and xmms are using the device. For an even clearer picture, use the device name rather than the mountpoint:
# lsof /dev/sdb1
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
bash 6925 root cwd DIR 8,17 4096 1 /media/usbdisk
xmms 6979 root cwd DIR 8,17 4096 1 /media/usbdisk
xmms 6979 root 8r REG 8,17 2713101 377 /media/usbdisk/a.mp3
You either can wait until those processes exit or terminate them manually.
Popular Posts
-
du stands for disk usage. This simple linux command provides a summary of harddisk or storage space disk usage. It has many parameter argume...
-
When developing applications, it is common to interact with various tools that require a network connection to function correctly. However, ...
-
How to block long list of consecutive IP address? How to call linux route command inside a script? How to block consecutive IP address usi...
-
Function to convert UTF-8 to WIN-1251 charset. function iconv-win1251 { if [ ${1%\.*} == ${1##*\.} ]; then newfile="$1-win1251&quo...
-
It is good to know that it's possible to play those classicNintendo NES games on any Android device with physical keyboard (Motorola Bac...
-
Using imagemagick imagemagick is a collection of tools and libraries for image manipulation. Most distribustions come with imagemagick . ...
-
Linux is at the forefront of web development. Recently, I've been developing web applications using frameworks, and Linux in general mak...
-
A common problem with computers is when you have a number of large files (such as audio/video clips) that you may want to get rid of. You ca...
-
Shell scripting is a way to write programs that run on Unix/Linux systems. It's a powerful skill to have since it allows users to automa...
-
Who says you have to pick between a netbook and the coming onslaught of standalone tablet devices? Okay maybe some (eh hem Apple), but Leno...