I have udev rules that creates a directory for each usb-media that is plugged into my debian to automount usb-media. This directory where mount-points (the mount-directories) are created is passed through a rdp-connection with rdesktop. On our terminalserver there's a drive Z that shows all mount-points with content of usb-media.

When users remove usb-media, udev unmounts usb-media and tries to delete the directory that was used to mount usb-media. If the users hasn't closed explorer showing any subfolder of usb-media, the unmount-command succeeds but the rmdir-command fails because the ressource is "busy or used".

My question: how can I force to delete this mountpoint? (rmdir doesn't have force and rm -rf doesn't work)

Edit: I should add, that I can't use third-party software or additional packages because the linux-machine is a thin-client with very low disk-space.

  • This is not normally a problem. I'd look to Samba for the issue. – Ignacio Vazquez-Abrams May 13 '11 at 11:39
  • what should I exactly look at? I'm not a linux-professional, I just have a few basic skills... – wullxz May 13 '11 at 11:51

The folder that I wasn't able to delete was a mount-point. It wasn't unmounted as I pulled the usb-stick off of the thin-client because the server had the content of that stick shown in explorer. Using the -l switch for umount in the udev-rule helped to force umount when the stick was removed anyway. Deletion of that mount-point wasn't a problem anymore after unmounting the stick.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.