Way to safely eject a USB hard drive from the lock screen

ejectscreen-lockusb

Often I come to my mac sitting on my desk in the morning and need to simply unplug it and put it in a bag. While maybe not strictly necessary to properly eject the attached USB drive, it sure would be nice if there were a way to do so without first logging in.

Best Answer

AFAIK there is no save way to eject an external drive from the lock screen.

You have several options though:

  1. Purchase and install Mountain and enable "Unmount external volumes on sleep". The feature still seems to be experimental.

  2. Create a LaunchDaemon which ejects your external drive(s) gracefully at say 5am. Here is an example of a bash script to start with:

    #!/bin/sh
    /usr/sbin/diskutil list | grep -e 'disk[1-9]s.*' | sed 's/.*\(disk[0-9].*\)/\1/' | xargs -I{}
    /usr/sbin/diskutil unmount {}
    

    If you don't want to write a LaunchDaemon, Sleepwatcher should support your efforts.

  3. Unmount all external volumes before setting your Mac(s) to sleep.