Spinning Down Optibay Solved! ~Remap Eject Key~

Discussion in 'MacBook Pro' started by nlynch77, Oct 27, 2013.

  1. nlynch77 macrumors member

    Mar 18, 2013
    Hello again MacRumors. Some time ago I installed an SSD in my 2011 MacBook Pro and moved the old HDD to the Optibay. All was good - except that it would never spin down. And if it did (after the 1 minute timer I set with pmset disksleep 1) it would quickly spin back up again for some reason or another. So enter my solution, remapping the eject key for dynamic, user-controlled disk startup/shutdown! Sadly, it takes a very roundabout way to make it happen.

    First, KeyRemap4Macbook, the program that makes this possible. Many thanks to the author! When you install, find "remap eject key" in the options. I remap'd eject to F13, but any unused button would do.

    Second, BetterTouchTool, which everyone should already have. When BTT is installed, add a new keyboard option so that F13 will activate an applescript (attached).

    Third (optional), an Automator action that allows you to post stuff to the Mountain Lion/Mavericks Notification Center. Makes this hack very aesthetic and functional.

    Make sure to enter your username and password in the script (so you don't need to authenticate every time)
    If you do not care about pretty Notification Center pop-ups, only download the Sample.zip, and remove any lines that have "tell application "___" to activate"

    These files I posted will work from anywhere (I think) so bury them deep in your Documents folder and forget.

    Attached Files:

  2. Intell macrumors P6


    Jan 24, 2010
    Why don't you just make a launchdaemon that will eject, not unmount, the drive when none of its volumes are mounted? That way the system will automatically suppress its spinups within a few seconds. You want to use the diskutil eject command instead of the unmount command because the eject causes it to stop spinning immediately. I could possibly rewrite and package my current solution for easy distribution.
  3. nlynch77 thread starter macrumors member

    Mar 18, 2013
    I would love to see an alternate way to do this, mine is rather clunky. The reason I chose to eject immediately is because the command diskutil unmount [diskname] doesn't immediately spin the drive down, whereas eject does, as well as ejecting any other partitions on the drive. When I (rarely) need to use the drive, I want to be able to press one button to turn it on, then one button to turn it off.

    A launchdaemon would be continuously running/checking the state of the drive, and I would need to use Finder to eject the drive, and the eject button doesn't eject anything other than CD's for some stupid reason.
  4. subwelt macrumors newbie

    Jul 4, 2012
    I am also about to put a SSD into my 2011 MBP and move the HD to the optibay. I tried to work through a 68-page long thread about the procedure and sort of gave up. Then I found this little thread which is a lot more digestible.
    So this is it for a problem that thousands of people must have? Manually switching the drive on and of? Actually I quite like it. The HD is only for storage anyway.
    But still I am puzzled. Is that what everyone is doing? Or are there other more orthodox solutions? Is everyone affected?
    I will try it out as soon as my slate arrives. Thanks for sharing nlynch77.
    I am not knowledgeable enough to try the Intell solution without further explanations.
  5. Maydon0z macrumors newbie

    Mar 23, 2013
    The sound of silence

    I know my post will revive this old thread, but I found a solution to spin down the Optibay harddisk in Mavericks.

    I combined the OP steps with another post I found here on the forums. Here are the steps needed to have the desired silence with just one keyboard click :cool:

    1- Get Karabiner and change the eject key to "F13".
    2- Open AppleScript Editor and paste this:

    Change the HDD to your Optibay harddisk name.
    Save the script as a script in a folder you like, i chose Applications.

    3- Get BetterTouchTool and assign the eject key (which is now F13) the action to start the script you just saved in step 2.

    Now, this will eject the optibay harddisk if it is spinning and will mount it when you need it. Step 4 could be to hide the icons of Karabiner and BetterTouchTool to clean the menubar, but this is optional.

Share This Page