Linux: how to discover open files from smbd ?

Matthew Kirkwood weejock at
Mon Mar 2 12:48:28 GMT 1998

> I have a CD-Changer and I want to change the cd under the share.
> this is done by a script, consisting of
>   unmounting the cdrom
>   changing the slot
>   mounting the cdrom again
> to successfully do this, there must be no open files or directories
> on the mountpoint.
> If I browse with windows-nt-filemanager on that share it seems there
> are files/dirs held open by smbd. in elder versions of smbd this
> time was very short, so one second was acceptable to wait.
> now in newer versions of smbd (maybe the new locking code) this time
> is unacceptable long, so I need to kill that smbd is sitting on that
> share.
> So my question:
> how to shorten that time

Hmm...  the "dead time" share parameter is in minutes, so you may have
trouble with this.  It shouldn't be too hard to hack the code to recognise
"dead time = 15s", though, and could be useful to others too...

> how to find the smbd is helding files/dirs open and killing it. There
> can be more than one smbd running, i should kill the right one.

fuser -mv /cd/mount/point will tell you all the processes with open files
on that filesystem.  fuser -km /cd/mount/point will (I think) kill all
processes accessing files on that filesystem.

For your cd changer script, you may like to look at the Linux autofs
automounter.  I'm sure a bit of hacking should enable you to sort it out
quite cleanly.


Matthew Kirkwood  |  Mail:  matthew.kirkwood at
LMH JCR,          |  Web:
Oxford OX2 6QA,   |  
England.          |  "To do things badly is a basic human right"

More information about the samba mailing list