The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 4,262 other subscribers

Archive for February 1st, 2024

Preventing to eject/unmount a MacOS drive (opposite of figuring out what prevents the unmount)

Posted by jpluimers on 2024/02/01

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 type screen in Terminal) and open the mount point from that session. This way you can even close Terminal, 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 an Automator action for it. For tips on screen see: [Wayback] kinnetica.com/2011/05/29/using-screen-on-mac-os-x

–jeroen

Posted in *nix, *nix-tools, Apple, Mac OS X / OS X / MacOS, Power User, screen, Terminal | Leave a Comment »