Umount - target busy

Petter Adsen petter at synth.no
Sun Oct 18 06:42:10 UTC 2015


On Sun, 18 Oct 2015 01:47:53 +0530
abhishek jain <ashujain9727 at gmail.com> wrote:

> You can use below command before unmounting.
> 
> fuser -mk <dev>

That might be a really bad idea, as that will kill any process that is
currently accessing the named device. If you have a running program
that is, for example, computing something and writing data, you would
probably rather want to write a loop to wait until it is finished -
there is an example on how to do this in the man page.

Another thing I failed to mention; it might be useful to do a 'sync'
before the 'umount /dev/whatever' instead of using 'fuser' to check if
the device is busy. That is probably why the umount fails in this case -
the kernel hasn't finished writing data to the device.

Petter

> sent from my Sony Xperia Smartphone
> On 17-Oct-2015 10:51 PM, "R Kimber" <richardkimber at btinternet.com> wrote:
> 
> > On Sat, 17 Oct 2015 16:37:57 +0200
> > Petter Adsen wrote:
> >  
> > > On Sat, 17 Oct 2015 15:23:56 +0100
> > > R Kimber <richardkimber at btinternet.com> wrote:
> > >  
> > > > I have a script that unmounts a drive at the end.  I sometimes get a
> > > > message saying "target is busy".
> > > >
> > > > Is there a way of testing whether the target is busy that I can use
> > > > before trying the umount, so that I can delay this command until I know
> > > > the umount will complete without error?
> > > >
> > > > - Richard.  
> > >
> > > See the man page for 'fuser' and take a look at the examples.
> > >
> > > Petter  
> >
> > Thanks, I hadn't thought of that.
> >
> > - Richard
> > --
> > Richard Kimber
> >
> >
> > --
> > ubuntu-users mailing list
> > ubuntu-users at lists.ubuntu.com
> > Modify settings or unsubscribe at:
> > https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
> >  



-- 
"I'm ionized"
"Are you sure?"
"I'm positive."



More information about the ubuntu-users mailing list