Article 5974A Unmounting and remounting an external disk on reconnect

Unmounting and remounting an external disk on reconnect

by
poisonborz
from LinuxQuestions.org on (#5974A)
I have a server, from which I host a few directories on an external hdd. I'd like to just yank out the disk any time I want (it's why it is external) without any prior preparation.

- on dismount: force unmount and remove the mount point, whatever process uses it
- on mount: mount it again

Is dismount like this possible without crashing my server?
I tried to write udev usb mount rules plus shell scripts (on add and remove), but:
- for remove/dismount, a umount -l does not work and the syslog just log disk errors whenever I try to to access the drive
- for add, mounting doesn't seem to work from the shell script. Yet after typing the command manually the mount occurs properly.

Is there a better strategy for this?latest?d=yIl2AUoC8zA latest?i=ANyEPduq9F0:45bHfFphn40:F7zBnMy latest?i=ANyEPduq9F0:45bHfFphn40:V_sGLiP latest?d=qj6IDK7rITs latest?i=ANyEPduq9F0:45bHfFphn40:gIN9vFwANyEPduq9F0
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments