Mounting an external drive when users are logged out in Mac OS X


Problem?

In older versions of Mac OS X, you could create a special .plist file that auto-mounts disks even when a user isn’t logged in. You can see that (no longer working) procedure here. I don’t know exactly when support for that ended, but some people have suggested around Mountain Lion. (If you try it in Yosemite, your Mac will get stuck in bootup at Waiting for DSMOS if you run it in verbose mode… or just half a progress bar if you’re booting it up in normal mode.)

People still want this feature, though. Here’s a recent thread of frustrated people not being able to do it:
10 *still* requires users to be logged in for backup to work.

Major Prerequisite

I’m assuming you already know how to create a script. If you don’t, use method #2 in Deleting Mac Keychains in an Active Directory Environment as an example.

Find the UUID of your external drive

There is a universally unique identifier for your drive. Unfortunately, the normal diskutil list command won’t show it to you. Instead, when you launch up the Terminal.app, you should run this command (make sure the drive is physically plugged in before you run the command):

diskutil list -plist
and that will show you your external drive’s UUID.

Highlight and copy the UUID.

Mount the drive via UUID

To do a quick test of mounting the drive, run a command similar to this:

diskutil mountDisk yourreallylonguniversallyuniqueidentifierfordrive
Whether that drive was already mounted or not, it should (if the command worked) display a message that says Volume(s) mounted successfully.

A visual example

mountexternalwithoutlogin
Here you can see an example.

So fire up those launch daemons and go ahead and put that mount command into your script!


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.