Unmounting and remounting an external disk on reconnect

Unmounting and remounting an external disk on reconnect

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?


Previous ACPI Error keeps coming back
Next 20.04 Dedicating GPU to CUDA and using Intel for Graphics

About author

You might also like

Ubuntu Dsicussions 0 Comments

[ubuntu] how can I stop audio output being routed to Dualshock 4 controller when plugged in?

Hello all, When I plug in my Dualshock 4 controller the audio is automatically routed to its 3.5mm port, meaning I have to go to “settings > sound > output

Ubuntu Dsicussions 0 Comments

The more I use Ubuntu 20.04 the more I like it!

Ubuntu 20.04 runs perfectly out of the box on my older HP desktop. I had problems with the new HP 15 laptop though and that wasn’t unexpected being it’s pretty

Ubuntu Dsicussions 0 Comments

[ubuntu] Moving away from Andriod and OSX and switching to linux for everything.

Hello Ladies n Gents, I hope you are all surviving though this covid situtation – i see no light at the end of the tunnel. Anyway, only a boring long


No Comments Yet!

You can be first to comment this post!

Leave a Reply