Not long after Figuring out which processes are preventing to eject/unmount my MacOS Time Machine backup USB drive, I wanted to do the opposite: prevent /Volumes/Sandisk1TB
from being ejected, as this is the “built-in” MicroSD card I use to store large or infrequently used files on (ISO and other disk images, drivers, hardware and software documentation, stuff to be installed on a fresh machine).
The opposite is straightforward: have a process keep at least one handle open on the Volume as per [Wayback] macos – How do I not accidentally eject external drives? – Ask Different (thanks [Wayback] kLy, [Wayback] dan and [Wayback] gerlos):
If your important external drive is mounted on the following mount point:
/Volumes/important_disk
Then you can protect it against an accidental removal by locking this mount point as opened. For this one very simple method consists in opening
Terminal
and doing this basic command:$ cd /Volumes/important_disk
To get rid of this locking, you might type within the same
Terminal
window:$ cd /
or you might as well just close this
Terminal
window ($ exit
, or ⌃+D, or ⌘+W).…
An even more elegant way to do it is open a
screen
session (just typescreen
inTerminal
) and open the mount point from that session. This way you can even closeTerminal
, since the session will keep running in the background, until you reattach it and stop it (so there’s no need to keep a window open if you don’t need it). I guess you can even create anAutomator
action for it. For tips onscreen
see: [Wayback] kinnetica.com/2011/05/29/using-screen-on-mac-os-x
–jeroen