Jump to content

Eject Specific Drives/Volumes/Mounts

Recommended Posts

My first workflow! I saw a similar one that ejected all disks but wanted more fine grained control over which disks to eject.


When you type the keyword 'eject' it shows a list of the ejectable drives. Simply press enter or click on one to eject the drive. A notification should pop up in the notification center if the drive has been ejected.


Some stats about the drives are shown such as protocol, partition type, and size. Icons are also changed per protocol. Workflow uses a python.






Let me know if you have any suggestions or find any bugs.



Share this post

Link to post

I rather like this workflow.

One suggestion is to add 'Mount' and 'Unmount' to the mix merhaps with a modifier of CMD or OPT


Thing is, I have a 2.5" drive in a USB 2 Enclosure under my desk. I never disconnect it and it's always powered. So, using this or the built in Alfred 'eject' will not just unmount(eject) a single partition on my Drive (which has 3 partitions), it always ejects the entire drive.


Also, with my other two partitions, I sometimes like to unmount one so it is not showing in Finder, but after a week or so, I may want to mount it for whatever purpose. SO, modifying your workflow to show mountable volumes would also be very handy. I currently have a workflow to simply mount a volume once I type in the name of it, but showing a list in Alfred, hitting CMD and selecting the unmounted volume would be ideal.


Idea for this: Show mounted volumes (the icons) as you do now, but if a volume is not mounted, perhaps the icon could be at 50%, like it is in Disk Utility.


I would personally like to modify this workflow to suit my personal needs, but I am clueless with python. I also do not want to step on your toes because you have started this awesome workflow and it would appear that you could add these features if you deem them necessary.

Share this post

Link to post

The workflow seems need an update, currently it's only displaying all the non "SATA" drives, but those internal "PCI-E" drives come with the new MacBooks will show in the list, while those are definitely not expected....

Share this post

Link to post

Is there any way to update this workflow to make it more compatible with later macbook pros (mid-2015)? Removing the internal "PCI-E" from the list would help avoid accidental ejection of the hard drive.

Share this post

Link to post

I haven't checked the new version you published, but the previous one requires a small change as of macOS Sierra.


diskutil info no longer refers to the size using the word 'size', but using the word 'space'. 


Therefore, the line "volume_size = re.search('Total Size:\s+(\S+\s\w+)', extra_info)" needs to be changed to "volume_size = re.search('Total Space:\s+(\S+\s\w+)', extra_info)"

Share this post

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...