Unmounting while “device is busy”


So, one of these days, you will find yourself wanting to unmount a partition on your linux box. Problem is, most of the time, the partition is most likely still being used by some process, or by someone. So first, you need to find out which processes are keeping the drive busy, by:



root@Mach5-NX:~# fuser -m /media/prison
/media/prison__:      3196c  3285c
root@Mach5-NX:~# ps -ef | grep 3285
ikhsan    3285  3196  0 07:07 pts/1    00:00:00 vi lgf.conf

With that information in hand, you can start shutting down services, or killing the process that’s preventing you from unmounting the partititon:

root@Mach5-NX:~# kill 3285

Repeat the step above for each process listed on the previous command.

Or, if you’re feeling nasty, you can always kill all the process that’s using the partition, by issuing:

root@Mach5-NX:~# fuser -km /media/prison
/media/prison__:      3350c  3437c

Unmount the drive normally

root@Mach5-NX:~# umount /media/prison

…And we’re done 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s