Jump to content

Workflow to mount volumes


Recommended Posts

Hi everyone,

 

I'm newish to the many powers of Alfred and I'd appreciate some help with creating a workflow to mount volumes via Alfred.

 

When a volume is ejected by Alfred, it remains mountable (see Disk Utility; the drive containing the volume isn't ejected) and I can open DU, select the volume in the sidebar and remount it by clicking in Mount on DU's toolbar.

 

I'd love to be able to type something like “mount [VolumeName]” in Alfred and have it magically be available once again.

 

Could any of you experienced Alfred users point me in a direction to have a functioning workflow? I'm really green in scripting, so any help would be truly appreciated.

 

 

Link to comment
12 hours ago, Selma said:

When a volume is ejected by Alfred

 

Yeah. I think Alfred only unmounts volumes and doesn't actually eject them.

 

12 hours ago, Selma said:

Could any of you experienced Alfred users point me in a direction to have a functioning workflow?

 

You can use /usr/sbin/diskutil list and /usr/sbin/diskutil info to get info about volumes, and show it in a Script Filter. Then you can use /usr/sbin/diskutil mount to mount your device.

Link to comment

This is amazing, thanks a lot for the workflow! It indeed lists /dev/disk#, but somehow only one partition of one of the disks gets mounted (which is an APFS main disk clone partition). Could I work around it to make other file systems mountable as well or would this work only with APFS? Much appreciated!

Link to comment
On 12/27/2020 at 1:19 AM, Selma said:

but somehow only one partition of one of the disks gets mounted (which is an APFS main disk clone partition).

 

That’s weird, because I’m using diskutil mountDisk, which per the documentation should Mount an entire disk (all mountable volumes). You can verify that on the Workflow’s Run Script and may want to play with it to see if you can get the desired result. Running diskutil on its own on a terminal will give you the available commands.

Link to comment
  • 8 months later...
On 12/26/2020 at 3:43 PM, vitor said:

Here’s a simple Workflow to do what you want. It’s pretty bare, in that it doesn’t show the volume’s name or size (it’s a quick semi-hackish solution which parses the human-readable output of diskutil instead of the plist), but unless you have a ton of external disks connected at once, it should fulfil your immediate needs.

Thanks for this.

 

I added to it:

  • mount Disk (lists by device name)
  • unmount Volume (lists by Volume name)
    [this is customised to ignore some my system volumes, you may want to edit it]
  • list external physical disks (opens Terminal to show output)

 

https://www.gingerbeardman.com/alfred/Disk Utilities.alfredworkflow

 

Notes

  • Ideally I'd like to list the main partitions of each disk device to make it easier to pick the correct one.
    That's the reason I added the list command.
  • At that point maybe it could be combined into one command using modifier key to choose mount or unmount, but that would require some more list processing and scripting and I'm not sure it's worth it.
Edited by vitor
Fix broken link to use %20 for space
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...