macos – Eject an external disk after you have not disconnected it properly

I have come across this problem again and again. On the one hand, we could say, "Always remember to eject your external drives before removing them." However, it is a fact that I am at least sometimes forgotten.

With macOS Mojave, this leads to a complete system failure. What happens is that the hard drive is still displayed as being connected to the computer but does not exist.

Any attempt to eject the hard disk, either through the user interface, the Disk Utility, or through commands such as umount -f / Volumes / TheDrive / fail (hang).

Also, for example, processes that depend on / Volumes / * depend Fuser / Volumes / TheDrive hangs and finally hangs the finder. This means that most software eventually hangs.

Attempting to restart the system hangs.

The Finder hangs and tries to restart the Finder.

The system becomes unusable and can not be restored. The problem can only be solved by keeping the power button pressed to turn off the power.

I am looking for a way to restore the system in this state. I'll probably have to quit certain processes and somehow eject / remove the (unconnected) external drive that is the culprit.

Research:
This is another problem, there is no answer. Eject / unmount external Ghost hard disk under macOS

This does not work https://www.mactrast.com/2012/07/quick-tip-force-a-disk-to-unmount-in-os-x/

This discussion is trivial and not helpful https://discussions.apple.com/thread/3619092

(and many other dead ends …)