Scheduling an Ejection of a Mounted Drive

Scenario:

On Wednesday and Friday mornings at 12:01 am, Carbon Copy Cloner backs up my Drobo 5N to a backup drive attached to my office server (my old 27" iMac). I have a two drive rotation system so that one backup can always be kept off-site.

Every Friday morning at 6:30 am, I get a reminder to give my wife the backup drive so she can store it at her work in a locked cabinet and at the end of the day she brings home the second drive.

When I head downstairs to my studio office at 6:30 am to get the drive, I don't want to have to wake up the computer, enter my password, eject the drive, wait for it to unmount and then physically disconnect it. I want it to unmount itself before I ever come downstairs.

I couldn't figure out how to easily accomplish this entirely in KM, so what I wound up doing is creating a simple two-step Automator action that unmounts my drive. I then use a KM macro to run that Automator action every Friday morning at 5:30 am. Now all I need to do is disconnect the drive and hand it to my wife.

This seems to be a fairly quick and easy solution for those who are not overly comfortable with shell scripts or Applescript.

Is this a reasonable solution or is there a better way yet?

Bill

Maybe I'm reading this wrong but my Carbon Copy Cloner unmounts after it's done.

I'm new to CCC but it looks like you are correct…I must have missed that. I love it when I learn something new!

It wouldn't be the first time that I went around the block just to get next door!

On the upside, I learned a bunch of other stuff so it wasn't time wasted.

B

I was about to change the task, but then the problem would be that it would unmount the destination drive after Wednesday morning's backup which would then make it unavailable to CCC for Friday's backup. CCC will automatically mount my Drobo if it's unavailable, but I don't think it will mount the destination drive if it's unavailable.

I suppose I could have a Wednesday task that leaves it mounted and a Friday task that ejects it.

You can always mount or unmount disks with AppleScript using a Keyboard Maestro macro that's on a schedule. I do this for both my Time Machine backup drives and my cloning drives. I only want them mounted when in use largely so they are not part of my regular Spotlight search results. For mounting a disk, this script does the trick:

 **set** theDisk **to** "Disk Name"

 **do shell script** "diskutil mount `diskutil list | awk '/ " & theDisk & " / {print $NF}'`"

To unmount a disk, the script looks like this:

 **set** theDisk **to** "Disk Name"

 **do shell script** "diskutil unmount `diskutil list | awk '/ " & theDisk & " / {print $NF}'`"

In both scripts, replace Disk Name with the name of your external volume(s).

1 Like

It looks like it will auto-mount the destination volume if necessary. I have never done this, I only use CCC manually, but it seems to indicate it will attempt to mount the destination drive.

1 Like

Thanks Peter!

I have modified my week 1 and week 2 tasks in CCC to automatically unmount the destination drive after backing up. Not that it matters, what I was calling my "Friday task" is technically Saturday at 12:01 am, I misspoke.

I now have rotating backups for my cold storage files on the Drobo, plus my Time Machine backups with one copy of each always stored off-site. All current work in progress resides in my Dropbox folder so it syncs with my MacBook Pro and gets backed up in the cloud. I haven't had copies stored off-site in years, but I sleep better knowing that they are there.

Thanks to everyone for their feedback, and even though it turned out I didn't need KM to complete this little task, I love it and am using it more and more!

Bill

Got fancy and added graphics to my backup drives. :roll_eyes:

Looks like what @kcwhat suggested should work:

but then . . .

And, it looks like @peternlewis' suggestion addresses that issue:

So, as you say, even though the KM tool is not needed, the people in the KM forum found the solution for you. :smile:

Good luck! I'm sure you will find man uses for KM, as we all do.

Since the KM Forum software will not allow you to check more than one post as the "solution", I'm going to check this post on the behalf of @kcwhat and @peternlewis, so that future readers can quickly see the solution.

1 Like