Sunday, June 20, 2010

Unmount a busy external drive!

It so happens that sometimes when you try to umount your pendrive, the system reports -

umount: /media/xyz : device is busy

It is clear that some process is using the drive. It would be nice to quickly find out the errant process so that necessary action can be taken.

We can find out which process is using the drive by fuser command -

#fuser -m /dev/sdx

where /dev/sdx is mounted on /media/xyz

Let us say that the output of the above command is

/dev/sdx: 538

Then

#ps -aux|grep 538

reveals the name of the errant programme, in my case rhythmbox :-)