How to Mount a Mac Drive to a Schedule

You can use Power Manager to automatically mount a hard drive on your Mac. This is particularly useful for preparing a drive for backing up or mirroring your files. When the back up is complete, you can also unmount the same drive with Power Manager.

Mounting a drive on macOS is not as simple as unmounting. To unmount a drive or volume on macOS, use the diskutil tool. The unmounting command to execute is:

diskutil eject <path to the volume to unmount>

So in my case, with a mounted volume/drive called Scratch, the full unmount command is:

diskutil eject /Volumes/Scratch/

For mounting the same drive, it is not so simple. The command to execute is:

diskutil mount <Volume ID>

Getting the Volume ID is not as trivial as passing a path to the volume. On macOS 10.12 and later, you can use the command line tool diskutil info to extract the required information. Alternatively you can navigate to the information through the graphic tool System Report.app:

Finder > Apple (menu) > About This Mac > System Report… > Storage

Once you have found the Volume ID, the resulting mount command can be executed:

diskutil mount 00000000-0000-FFFF-FFFF-00FF00FF00FF

With Power Manager 4.6, we added a few features to help create an event to mount a drive. Let's create an event that mounts a drive each weekday evening.

Create a Mount Drive Event

  1. Launch Power Manager.app

    Launch Power Manager on macOS

  2. Select Add… or File (menu) > New… > New Event… and then Executable a command line tool daily from the Schedule Assistant.

    Select the Executable a command line tool daily task

  3. Continue to the Executable step and for the Executable enter the full path to the diskutil tool: /usr/sbin/diskutil.

  4. For the Arguments to pass to the tool, Add two items:

    • For the first item: Add (pop-up menu) > Blank > Enter mount
    • For the second item: Add (pop-up menu) > Volume UUIDs and select your volume to mount; Power Manager will look-up the associated Volume ID for you.

      Enter the executable and arguments

      Use the Volume UUIDs menu to get the volume identifier

  5. Continue to the Environment step and select Super User (root) for Run as which user?. Performing the command as root ensures the drive is mounted even when no-one is logged into your Mac.

    Select Super User for the Environment

  6. Continue to the When step and enter the time and days to perform.

    Enter the time of day and days of week to mount the volume

  7. Continue to the Constraints step. Here you can provide any additional constraints. In this instance, there is nothing to select or change.

    Continue passed the Constraints step

  8. Continue to the Why step to name and describe your event.

    Name and document your new event

  9. Continue and Add your new automatic drive/volume mounting event.

    Continue and add your event

    The automatic daily shut down event is ready to customise

Your new event is complete and ready to use.

You should now test your new event. You can do this by unmounting the drive or volume in the Finder, and then triggering your new Power Manager event. Trigger the event using either the menu item in the top-right of your menu bar, or through the Power Manager.app > Scheduler (menu) > Show Engine interface.

If all goes well, a second or two after triggering the event your drive will mount and be available on your Mac.

If the drive is mounted when the event runs, nothing will happen and the drive will remain mounted.

This article was posted in , , and and tagged , , , and .

Published by Graham Miln on