Umount a busy partition


Check & close the applications which are using any mounted partition or folder

If you are using a separate partition for your applications, you need to mount that partition to a folder. Then only you can store & run the application. But if you want to umount that partition again, first you need to close all the applications which are using that mounted partition or folder.

To check all the application running from that partition or folder, just issue a simple command:

fuser -mv

or

fuser -mv

For example:

fuser -mv /dev/sda1

or

fuser -mv /usr/local/bin

The above commands can show the output as follows:

USER        PID ACCESS COMMAND
/dev/sda1:         root       2467 .rce. mingetty
root       2476 .rce. mingetty
root       2502 .rc.. kauditd
root       2506 .rce. sshd
root       2509 .rce. bash

You can also use the following command:

fuser -mv /dev/sda1 > /tmp/sda1.pids

It will store the PIDs of all application running from ‘/dev/sda1’ partition.

Now you can simply issue the ‘kill’ command to close all the applications forcefully.

kill -9 `cat /tmp/sda1.pids`

It will free the partition /dev/sda1 to umount.

WARNING!!!

Don’t use this method on active partitions, it can cause the OS failure. But after reboot it may be recovered.

Advertisements

One thought on “Umount a busy partition

  1. Pingback: Tweets that mention Umount a busy partition « Linux Explore -- Topsy.com

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